diff --git a/llvm/lib/Target/VE/VEInstrInfo.td b/llvm/lib/Target/VE/VEInstrInfo.td --- a/llvm/lib/Target/VE/VEInstrInfo.td +++ b/llvm/lib/Target/VE/VEInstrInfo.td @@ -205,6 +205,12 @@ let PrintMethod = "printMImmOperand"; } +// zerofp - Generic fp immediate zero value. +def zerofp : Operand, PatLeaf<(fpimm), [{ + return getFpImmVal(N) == 0; }]> { + let ParserMatchClass = ZeroAsmOperand; +} + // simm7fp - Generic fp immediate value. def simm7fp : Operand, PatLeaf<(fpimm), [{ return isInt<7>(getFpImmVal(N)); @@ -827,10 +833,17 @@ !strconcat(opcStr, ".t ", cmpStr, "$imm32")>; } multiclass BCRm opc, - RegisterClass RC, Operand immOp> { + RegisterClass RC, Operand immOp, Operand zeroOp> { defm rr : BCRbpfm; let cy = 0 in - defm ir : BCRbpfm; + defm ir : BCRbpfm; + let cz = 0 in + defm rz : BCRbpfm; + let cy = 0, cz = 0 in + defm iz : BCRbpfm; let cy = 0, sy = 0, cz = 0, sz = 0, cf = 15 /* AT */, isBarrier = 1 in defm a : BCRbpfm; let cy = 0, sy = 0, cz = 0, sz = 0, cf = 0 /* AF */ in @@ -1409,13 +1422,13 @@ // Section 8.8.4 - BCR (Branch on Condition Relative) let cx = 0, cx2 = 0 in -defm BRCFL : BCRm<"br${cf}.l", "br.l", "braf.l", 0x18, I64, simm7>; +defm BRCFL : BCRm<"br${cf}.l", "br.l", "braf.l", 0x18, I64, simm7, zero>; let cx = 1, cx2 = 0 in -defm BRCFW : BCRm<"br${cf}.w", "br.w", "braf.w", 0x18, I32, simm7>; +defm BRCFW : BCRm<"br${cf}.w", "br.w", "braf.w", 0x18, I32, simm7, zero>; let cx = 0, cx2 = 1 in -defm BRCFD : BCRm<"br${cf}.d", "br.d", "braf.d", 0x18, I64, simm7fp>; +defm BRCFD : BCRm<"br${cf}.d", "br.d", "braf.d", 0x18, I64, simm7fp, zerofp>; let cx = 1, cx2 = 1 in -defm BRCFS : BCRm<"br${cf}.s", "br.s", "braf.s", 0x18, F32, simm7fp>; +defm BRCFS : BCRm<"br${cf}.s", "br.s", "braf.s", 0x18, F32, simm7fp, zerofp>; // Section 8.8.5 - BSIC (Branch and Save IC) let isCall = 1, hasSideEffects = 0, DecoderMethod = "DecodeCall" in diff --git a/llvm/test/MC/VE/BCR.s b/llvm/test/MC/VE/BCR.s --- a/llvm/test/MC/VE/BCR.s +++ b/llvm/test/MC/VE/BCR.s @@ -19,6 +19,10 @@ # CHECK-ENCODING: encoding: [0xe0,0x00,0x00,0x00,0x94,0x17,0xc1,0x18] brgt.s 23, %s20, 224 +# CHECK-INST: brlt.l %s18, 0, -224 +# CHECK-ENCODING: encoding: [0x20,0xff,0xff,0xff,0x00,0x92,0x02,0x18] +brlt.l %s18, 0, -224 + # CHECK-INST: brlt.l.t 23, %s20, -224 # CHECK-ENCODING: encoding: [0x20,0xff,0xff,0xff,0x94,0x17,0x32,0x18] brlt.l.t 23, %s20, -224 @@ -31,6 +35,10 @@ # CHECK-ENCODING: encoding: [0x20,0xff,0xff,0xff,0x94,0x17,0x44,0x18] breq.d 23, %s20, -224 +# CHECK-INST: breq.d %s20, 0, -224 +# CHECK-ENCODING: encoding: [0x20,0xff,0xff,0xff,0x00,0x94,0x44,0x18] +breq.d %s20, 0, -224 + # CHECK-INST: brge.s.t 23, %s20, 8192 # CHECK-ENCODING: encoding: [0x00,0x20,0x00,0x00,0x94,0x17,0xf5,0x18] brge.s.t 23, %s20, 8192