[llvm] [AMDGPU] - Add s_bitreplicate intrinsic (PR #69209)
Sebastian Neubauer via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 07:25:38 PDT 2023
================
@@ -6297,6 +6297,14 @@ SIInstrInfo::legalizeOperands(MachineInstr &MI,
return CreatedBB;
}
+ // Legalize S_BITREPLICATE
+ if (MI.getOpcode() == AMDGPU::S_BITREPLICATE_B64_B32) {
+ MachineOperand &Src = MI.getOperand(1);
+ if (Src.isReg() && RI.hasVectorRegisters(MRI.getRegClass(Src.getReg())))
+ Src.setReg(readlaneVGPRToSGPR(Src.getReg(), MI, MRI));
+ return CreatedBB;
+ }
----------------
Flakebi wrote:
There’s more discussions and reasoning about this in the main thread of this PR, but as far as I understand the intention, the intrinsic only accepts uniform values. From the intrinsic definition:
```
The argument must be uniform; otherwise, the result is undefined.
```
A uniform value can still end up in a VGPR, so it makes sense to me to use readfirstlane in that case.
https://github.com/llvm/llvm-project/pull/69209
More information about the llvm-commits
mailing list