From c74211d87eb53cb310703dec2c504b26d7f24bdf Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 3 Sep 2015 13:22:28 +0200 Subject: Added builtin for mbar instruction. This commit adds a builtin function for the mbar instruction. --- powerpc/Asmexpand.ml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'powerpc/Asmexpand.ml') diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index f266f3ec..3e57cdbf 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -466,6 +466,12 @@ let expand_builtin_inline name args res = emit (Pisync) | "__builtin_lwsync", [], _ -> emit (Plwsync) + | "__builtin_mbar", [BA_int mo], _ -> + if not (mo = _0 || mo = _1) then + raise (Error "the argument of __builtin_mbar must be either 0 or 1"); + emit (Pmbar mo) + | "__builin_mbar",_, _ -> + raise (Error "the argument of __builtin_mbar must be a constant"); | "__builtin_trap", [], _ -> emit (Ptrap) (* Vararg stuff *) -- cgit