Skip to content

Commit d11afe1

Browse files
authored
SystemZ: Handle gr128 to fp128 copies in copyPhysReg (#90861)
1 parent eb3a671 commit d11afe1

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,22 @@ void SystemZInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
856856
return;
857857
}
858858

859+
if (SystemZ::FP128BitRegClass.contains(DestReg) &&
860+
SystemZ::GR128BitRegClass.contains(SrcReg)) {
861+
MCRegister DestRegHi = RI.getSubReg(DestReg, SystemZ::subreg_h64);
862+
MCRegister DestRegLo = RI.getSubReg(DestReg, SystemZ::subreg_l64);
863+
MCRegister SrcRegHi = RI.getSubReg(SrcReg, SystemZ::subreg_h64);
864+
MCRegister SrcRegLo = RI.getSubReg(SrcReg, SystemZ::subreg_l64);
865+
866+
BuildMI(MBB, MBBI, DL, get(SystemZ::LDGR), DestRegHi)
867+
.addReg(SrcRegHi)
868+
.addReg(DestReg, RegState::ImplicitDefine);
869+
870+
BuildMI(MBB, MBBI, DL, get(SystemZ::LDGR), DestRegLo)
871+
.addReg(SrcRegLo, getKillRegState(KillSrc));
872+
return;
873+
}
874+
859875
// Move CC value from a GR32.
860876
if (DestReg == SystemZ::CC) {
861877
unsigned Opcode =
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
2+
# RUN: llc -mtriple=s390x-ibm-linux -mcpu=z13 -run-pass=postrapseudos -verify-machineinstrs -o - %s | FileCheck %s
3+
4+
---
5+
name: copy_gr128_to_fp128__r0q_to_f0q
6+
tracksRegLiveness: true
7+
body: |
8+
bb.0:
9+
liveins: $r0q
10+
; CHECK-LABEL: name: copy_gr128_to_fp128__r0q_to_f0q
11+
; CHECK: liveins: $r0q
12+
; CHECK-NEXT: {{ $}}
13+
; CHECK-NEXT: $f0d = LDGR $r0d, implicit-def $f0q
14+
; CHECK-NEXT: $f2d = LDGR $r1d
15+
; CHECK-NEXT: Return implicit $f0q
16+
$f0q = COPY $r0q
17+
Return implicit $f0q
18+
...
19+
20+
---
21+
name: copy_gr128_to_fp128__r0q_to_f0q_killed
22+
tracksRegLiveness: true
23+
body: |
24+
bb.0:
25+
liveins: $r0q
26+
; CHECK-LABEL: name: copy_gr128_to_fp128__r0q_to_f0q_killed
27+
; CHECK: liveins: $r0q
28+
; CHECK-NEXT: {{ $}}
29+
; CHECK-NEXT: $f0d = LDGR $r0d, implicit-def $f0q
30+
; CHECK-NEXT: $f2d = LDGR killed $r1d
31+
; CHECK-NEXT: Return implicit $f0q
32+
$f0q = COPY killed $r0q
33+
Return implicit $f0q
34+
...
35+
36+
---
37+
name: copy_gr128_to_fp128__r0q_to_f0q_undef
38+
tracksRegLiveness: true
39+
body: |
40+
bb.0:
41+
liveins: $r0q
42+
; CHECK-LABEL: name: copy_gr128_to_fp128__r0q_to_f0q_undef
43+
; CHECK: liveins: $r0q
44+
; CHECK-NEXT: {{ $}}
45+
; CHECK-NEXT: $f0q = KILL undef $r0q
46+
; CHECK-NEXT: Return implicit $f0q
47+
$f0q = COPY undef $r0q
48+
Return implicit $f0q
49+
...

0 commit comments

Comments
 (0)