diff --git a/llvm/lib/Target/PowerPC/PPCInstrPrefix.td b/llvm/lib/Target/PowerPC/PPCInstrPrefix.td --- a/llvm/lib/Target/PowerPC/PPCInstrPrefix.td +++ b/llvm/lib/Target/PowerPC/PPCInstrPrefix.td @@ -481,6 +481,13 @@ let Inst{31} = 0; } +// X-Form: [ PO RT BI /// XO / ] +class XForm_XT5_BI5 opcode, bits<10> xo, dag OOL, dag IOL, + string asmstr, InstrItinClass itin, list pattern> + : XForm_base_r3xo { + let B = 0; +} + multiclass MLS_DForm_R_SI34_RTA5_MEM_p opcode, dag OOL, dag IOL, dag PCRel_IOL, string asmstr, InstrItinClass itin> { @@ -877,6 +884,26 @@ } let Predicates = [IsISA3_1] in { + def SETBC : XForm_XT5_BI5<31, 384, (outs gprc:$RT), (ins crbitrc:$BI), + "setbc $RT, $BI", IIC_IntCompare, []>; + def SETBCR : XForm_XT5_BI5<31, 416, (outs gprc:$RT), (ins crbitrc:$BI), + "setbcr $RT, $BI", IIC_IntCompare, []>; + def SETNBC : XForm_XT5_BI5<31, 448, (outs gprc:$RT), (ins crbitrc:$BI), + "setnbc $RT, $BI", IIC_IntCompare, []>; + def SETNBCR : XForm_XT5_BI5<31, 480, (outs gprc:$RT), (ins crbitrc:$BI), + "setnbcr $RT, $BI", IIC_IntCompare, []>; + + let Interpretation64Bit = 1, isCodeGenOnly = 1 in { + def SETBC8 : XForm_XT5_BI5<31, 384, (outs g8rc:$RT), (ins crbitrc:$BI), + "setbc $RT, $BI", IIC_IntCompare, []>; + def SETBCR8 : XForm_XT5_BI5<31, 416, (outs g8rc:$RT), (ins crbitrc:$BI), + "setbcr $RT, $BI", IIC_IntCompare, []>; + def SETNBC8 : XForm_XT5_BI5<31, 448, (outs g8rc:$RT), (ins crbitrc:$BI), + "setnbc $RT, $BI", IIC_IntCompare, []>; + def SETNBCR8 : XForm_XT5_BI5<31, 480, (outs g8rc:$RT), (ins crbitrc:$BI), + "setnbcr $RT, $BI", IIC_IntCompare, []>; + } + def VSLDBI : VNForm_VTAB5_SD3<22, 0, (outs vrrc:$VRT), (ins vrrc:$VRA, vrrc:$VRB, u3imm:$SH), "vsldbi $VRT, $VRA, $VRB, $SH", diff --git a/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-ISA31.txt b/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-ISA31.txt --- a/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-ISA31.txt +++ b/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-ISA31.txt @@ -225,6 +225,18 @@ # CHECK: xxblendvd 6, 63, 21, 34 0x05 0x00 0x00 0x00 0x84 0xdf 0xa8 0xbc +# CHECK: setbc 21, 11 +0x7e 0xab 0x03 0x00 + +# CHECK: setbcr 21, 11 +0x7e 0xab 0x03 0x40 + +# CHECK: setnbc 21, 11 +0x7e 0xab 0x03 0x80 + +# CHECK: setnbcr 21, 11 +0x7e 0xab 0x03 0xc0 + # CHECK: vsldbi 2, 3, 4, 5 0x10 0x43 0x21 0x56 diff --git a/llvm/test/MC/PowerPC/ppc64-encoding-ISA31.s b/llvm/test/MC/PowerPC/ppc64-encoding-ISA31.s --- a/llvm/test/MC/PowerPC/ppc64-encoding-ISA31.s +++ b/llvm/test/MC/PowerPC/ppc64-encoding-ISA31.s @@ -351,6 +351,18 @@ # CHECK-LE: xxblendvd 6, 63, 21, 34 # encoding: [0x00,0x00,0x00,0x05, # CHECK-LE-SAME: 0xbc,0xa8,0xdf,0x84] xxblendvd 6, 63, 21, 34 +# CHECK-BE: setbc 21, 11 # encoding: [0x7e,0xab,0x03,0x00] +# CHECK-LE: setbc 21, 11 # encoding: [0x00,0x03,0xab,0x7e] + setbc 21, 11 +# CHECK-BE: setbcr 21, 11 # encoding: [0x7e,0xab,0x03,0x40] +# CHECK-LE: setbcr 21, 11 # encoding: [0x40,0x03,0xab,0x7e] + setbcr 21, 11 +# CHECK-BE: setnbc 21, 11 # encoding: [0x7e,0xab,0x03,0x80] +# CHECK-LE: setnbc 21, 11 # encoding: [0x80,0x03,0xab,0x7e] + setnbc 21, 11 +# CHECK-BE: setnbcr 21, 11 # encoding: [0x7e,0xab,0x03,0xc0] +# CHECK-LE: setnbcr 21, 11 # encoding: [0xc0,0x03,0xab,0x7e] + setnbcr 21, 11 # CHECK-BE: vsldbi 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x56] # CHECK-LE: vsldbi 2, 3, 4, 5 # encoding: [0x56,0x21,0x43,0x10] vsldbi 2, 3, 4, 5