Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,8 @@ void SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
}

if (DestReg == AMDGPU::VCC) {
if (AMDGPU::SReg_64RegClass.contains(SrcReg)) {
if (AMDGPU::SReg_64RegClass.contains(SrcReg) ||
AMDGPU::SReg_64_EncodableRegClass.contains(SrcReg)) {
BuildMI(MBB, MI, DL, get(AMDGPU::S_MOV_B64), AMDGPU::VCC)
.addReg(SrcReg, getKillRegState(KillSrc));
} else {
Expand Down
9 changes: 9 additions & 0 deletions llvm/test/CodeGen/AMDGPU/sgpr-phys-copy.mir
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ body: |
$sgpr0_sgpr1 = COPY $src_shared_base
...

---
name: src_shared_base_to_vcc
body: |
bb.0:
; GFX9-LABEL: name: src_shared_base_to_vcc
; GFX9: $vcc = S_MOV_B64 $src_shared_base
$vcc = COPY $src_shared_base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also test the inverse case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping. We do not structurally prevent writing to constant registers and it is encodable

Copy link
Member Author

@carlobertolli carlobertolli Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arsenm I added a test to copy vcc to shared_base but it fails

name: vcc_to_src_shared_base
body: |
bb.0:
; GFX9-LABEL: name: vcc_to_src_shared_base
; GFX9: $src_shared_base = S_MOV_B64 $vcc
$src_shared_base = COPY $vcc
...

I';ll have to fix the copy to enable this, unless I misunderstood you?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like this?
#164138

...

---
name: sgpr96_aligned_src_dst
body: |
Expand Down
Loading