From 99ef10f9156e818ca85da2421f8b3cb776afba87 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Tue, 29 Jul 2014 23:16:31 +0000 Subject: [PATCH] Recognize BookE's mbar instruction. llvm-svn: 214244 --- llvm/lib/Target/PowerPC/PPCInstrFormats.td | 9 +++++++++ llvm/lib/Target/PowerPC/PPCInstrInfo.td | 3 +++ llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-bookII.txt | 3 +++ llvm/test/MC/PowerPC/ppc64-encoding-bookII.s | 3 +++ 4 files changed, 18 insertions(+) diff --git a/llvm/lib/Target/PowerPC/PPCInstrFormats.td b/llvm/lib/Target/PowerPC/PPCInstrFormats.td index c95aefa..d40a9ab 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrFormats.td +++ b/llvm/lib/Target/PowerPC/PPCInstrFormats.td @@ -468,6 +468,15 @@ class XForm_sr opcode, bits<10> xo, dag OOL, dag IOL, string asmstr, let Inst{21-30} = xo; } +class XForm_mbar opcode, bits<10> xo, dag OOL, dag IOL, string asmstr, + InstrItinClass itin> + : I { + bits<5> MO; + + let Inst{6-10} = MO; + let Inst{21-30} = xo; +} + class XForm_srin opcode, bits<10> xo, dag OOL, dag IOL, string asmstr, InstrItinClass itin> : I { diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td index 5b8cb5c..18398530 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -3046,6 +3046,9 @@ def EIEIO : XForm_24_eieio<31, 854, (outs), (ins), def WAIT : XForm_24_sync<31, 62, (outs), (ins i32imm:$L), "wait $L", IIC_LdStLoad, []>; +def MBAR : XForm_mbar<31, 854, (outs), (ins u5imm:$MO), + "mbar $MO", IIC_LdStLoad>, Requires<[IsBookE]>; + def MTSR: XForm_sr<31, 210, (outs), (ins gprc:$RS, u4imm:$SR), "mtsr $SR, $RS", IIC_SprMTSR>; diff --git a/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-bookII.txt b/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-bookII.txt index 5e6033d..f0ef902 100644 --- a/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-bookII.txt +++ b/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-bookII.txt @@ -33,6 +33,9 @@ # CHECK: wait 2 0x7c 0x40 0x00 0x7c +# CHECK: mbar 1 +0x7c 0x20 0x06 0xac + # CHECK: dcbf 2, 3 0x7c 0x02 0x18 0xac diff --git a/llvm/test/MC/PowerPC/ppc64-encoding-bookII.s b/llvm/test/MC/PowerPC/ppc64-encoding-bookII.s index 99796ca..9e109e1 100644 --- a/llvm/test/MC/PowerPC/ppc64-encoding-bookII.s +++ b/llvm/test/MC/PowerPC/ppc64-encoding-bookII.s @@ -53,6 +53,9 @@ # CHECK-BE: wait 2 # encoding: [0x7c,0x40,0x00,0x7c] # CHECK-LE: wait 2 # encoding: [0x7c,0x00,0x40,0x7c] wait 2 +# CHECK-BE: mbar 1 # encoding: [0x7c,0x20,0x06,0xac] +# CHECK-LE: mbar 1 # encoding: [0xac,0x06,0x20,0x7c] + mbar 1 # Extended mnemonics -- 2.7.4