Skip to content

Commit 70197ed

Browse files
committed
[Xtensa] Minor fix and added tests.
1 parent 4f39723 commit 70197ed

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

llvm/lib/Target/Xtensa/XtensaInstrInfo.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ void XtensaInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
122122
.addReg(SrcReg, getKillRegState(KillSrc))
123123
.addReg(SrcReg, getKillRegState(KillSrc));
124124
return;
125-
} else if (STI.hasSingleFloat() && Xtensa::FPRRegClass.contains(SrcReg) &&
126-
Xtensa::FPRRegClass.contains(DestReg))
125+
}
126+
127+
if (STI.hasSingleFloat() && Xtensa::FPRRegClass.contains(SrcReg) &&
128+
Xtensa::FPRRegClass.contains(DestReg))
127129
Opcode = Xtensa::MOV_S;
128130
else if (STI.hasSingleFloat() && Xtensa::FPRRegClass.contains(SrcReg) &&
129131
Xtensa::ARRegClass.contains(DestReg))

llvm/test/CodeGen/Xtensa/s32c1i.ll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
; RUN: llc -mtriple=xtensa -mattr=+s32c1i -filetype=obj %s -o - | llvm-objdump --arch=xtensa --mattr=s32c1i -d - | FileCheck %s -check-prefix=XTENSA
2+
3+
define i32 @constraint_i(i32 %a) {
4+
; XTENSA: 0: 22 e2 01 s32c1i a2, a2, 4
5+
%res = tail call i32 asm "s32c1i $0, $1, $2", "=r,r,i"(i32 %a, i32 4)
6+
ret i32 %res
7+
}

llvm/test/MC/Xtensa/s32c1i.s

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# RUN: llvm-mc %s -triple=xtensa -show-encoding --mattr=+s32c1i \
2+
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
3+
4+
.align 4
5+
LBL0:
6+
7+
# CHECK-INST: xsr a3, atomctl
8+
# CHECK: # encoding: [0x30,0x63,0x61]
9+
xsr a3, atomctl
10+
11+
# CHECK-INST: xsr a3, scompare1
12+
# CHECK: # encoding: [0x30,0x0c,0x61]
13+
xsr a3, scompare1

0 commit comments

Comments
 (0)