Skip to content

Commit 4069299

Browse files
[PowerPC] Fix the register class for the instruction paddi. (#73995)
The register class for the PADDI definition is incorrect as register zero for RA is treated as an actual zero.
1 parent 1f8f9e3 commit 4069299

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

llvm/lib/Target/PowerPC/PPCInstrP10.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ def RCCp {
615615
let Predicates = [PrefixInstrs] in {
616616
let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
617617
defm PADDI8 :
618-
MLS_DForm_R_SI34_RTA5_p<14, (outs g8rc:$RT), (ins g8rc:$RA, s34imm:$SI),
618+
MLS_DForm_R_SI34_RTA5_p<14, (outs g8rc:$RT), (ins g8rc_nox0:$RA, s34imm:$SI),
619619
(ins immZero:$RA, s34imm_pcrel:$SI),
620620
"paddi $RT, $RA, $SI", IIC_LdStLFD>;
621621
let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
@@ -625,7 +625,7 @@ let Predicates = [PrefixInstrs] in {
625625
}
626626
}
627627
defm PADDI :
628-
MLS_DForm_R_SI34_RTA5_p<14, (outs gprc:$RT), (ins gprc:$RA, s34imm:$SI),
628+
MLS_DForm_R_SI34_RTA5_p<14, (outs gprc:$RT), (ins gprc_nor0:$RA, s34imm:$SI),
629629
(ins immZero:$RA, s34imm_pcrel:$SI),
630630
"paddi $RT, $RA, $SI", IIC_LdStLFD>;
631631
let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# RUN: llvm-mc -triple powerpc64-unknown-linux-gnu --show-encoding -ppc-asm-full-reg-names %s | \
2+
# RUN: FileCheck -check-prefix=CHECK-BE %s
3+
# RUN: llvm-mc -triple powerpc64le-unknown-linux-gnu --show-encoding -ppc-asm-full-reg-names %s | \
4+
# RUN: FileCheck -check-prefix=CHECK-LE %s
5+
6+
# CHECK-BE: addi r1, r2, 700 # encoding: [0x38,0x22,0x02,0xbc]
7+
# CHECK-LE: addi r1, r2, 700 # encoding: [0xbc,0x02,0x22,0x38]
8+
addi 1, 2, 700
9+
10+
# CHECK-BE: li r1, 700 # encoding: [0x38,0x20,0x02,0xbc]
11+
# CHECK-LE: li r1, 700 # encoding: [0xbc,0x02,0x20,0x38]
12+
addi 1, 0, 700
13+
14+
# CHECK-BE: paddi r1, r2, 6400000, 0 # encoding: [0x06,0x00,0x00,0x61,
15+
# CHECK-BE-SAME: 0x38,0x22,0xa8,0x00]
16+
# CHECK-LE: paddi r1, r2, 6400000, 0 # encoding: [0x61,0x00,0x00,0x06,
17+
# CHECK-LE-SAME: 0x00,0xa8,0x22,0x38]
18+
paddi 1, 2, 6400000, 0
19+
20+
# CHECK-BE: paddi r1, 0, 6400000, 0 # encoding: [0x06,0x00,0x00,0x61,
21+
# CHECK-BE-SAME: 0x38,0x20,0xa8,0x00]
22+
# CHECK-LE: paddi r1, 0, 6400000, 0 # encoding: [0x61,0x00,0x00,0x06,
23+
# CHECK-LE-SAME: 0x00,0xa8,0x20,0x38]
24+
paddi 1, 0, 6400000, 0

0 commit comments

Comments
 (0)