@@ -2294,11 +2294,15 @@ def : InstAlias<"move $dst, $src", (OR GPR:$dst, GPR:$src, R0)>;
22942294def : InstAlias<"ret", (JIRL R0, R1, 0)>;
22952295def : InstAlias<"jr $rj", (JIRL R0, GPR:$rj, 0)>;
22962296
2297- // Branches implemented with alias.
2298- // Always output the canonical mnemonic for the pseudo branch instructions.
2299- // The GNU tools emit the canonical mnemonic for the branch pseudo instructions
2300- // as well (e.g. "bgt" will be recognised by the assembler but never printed by
2301- // objdump). Match this behaviour by setting a zero weight.
2297+ // Branches implemented with aliases.
2298+ // Disassemble branch instructions not having a $zero operand to the
2299+ // canonical mnemonics respectively, but disassemble BLT/BGE with a $zero
2300+ // operand to the corresponding pseudo-instruction.
2301+ // GNU Binutils behave like this since 2.41, e.g. "bgt" will be recognised
2302+ // by the assembler but always disassembles as "blt" by objdump, while "bgtz"
2303+ // will come back intact.
2304+ // Match this behaviour by setting a zero weight for the b{gt,le}{,u}
2305+ // patterns only.
23022306def : InstAlias<"bgt $rj, $rd, $imm16",
23032307 (BLT GPR:$rd, GPR:$rj, simm16_lsl2_br:$imm16), 0>;
23042308def : InstAlias<"bgtu $rj, $rd, $imm16",
@@ -2308,13 +2312,13 @@ def : InstAlias<"ble $rj, $rd, $imm16",
23082312def : InstAlias<"bleu $rj, $rd, $imm16",
23092313 (BGEU GPR:$rd, GPR:$rj, simm16_lsl2_br:$imm16), 0>;
23102314def : InstAlias<"bltz $rd, $imm16",
2311- (BLT GPR:$rd, R0, simm16_lsl2_br:$imm16), 0 >;
2315+ (BLT GPR:$rd, R0, simm16_lsl2_br:$imm16)>;
23122316def : InstAlias<"bgtz $rj, $imm16",
2313- (BLT R0, GPR:$rj, simm16_lsl2_br:$imm16), 0 >;
2317+ (BLT R0, GPR:$rj, simm16_lsl2_br:$imm16)>;
23142318def : InstAlias<"blez $rj, $imm16",
2315- (BGE R0, GPR:$rj, simm16_lsl2_br:$imm16), 0 >;
2319+ (BGE R0, GPR:$rj, simm16_lsl2_br:$imm16)>;
23162320def : InstAlias<"bgez $rd, $imm16",
2317- (BGE GPR:$rd, R0, simm16_lsl2_br:$imm16), 0 >;
2321+ (BGE GPR:$rd, R0, simm16_lsl2_br:$imm16)>;
23182322
23192323// Load immediate.
23202324let hasSideEffects = 0, mayLoad = 0, mayStore = 0, isCodeGenOnly = 0,
0 commit comments