Skip to content

Commit a1d24da

Browse files
committed
fix vgprimm for t16
1 parent 3bd71cb commit a1d24da

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,11 @@ def cond_as_i32imm: SDNodeXForm<cond, [{
846846
}]>;
847847

848848
// Copied from the AArch64 backend:
849+
def bitcast_fpimm_to_i16 : SDNodeXForm<fpimm, [{
850+
return CurDAG->getTargetConstant(
851+
N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i16);
852+
}]>;
853+
849854
def bitcast_fpimm_to_i32 : SDNodeXForm<fpimm, [{
850855
return CurDAG->getTargetConstant(
851856
N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i32);

llvm/lib/Target/AMDGPU/SIInstructions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,7 @@ let True16Predicate = UseRealTrue16Insts in {
22832283
foreach vt = [f16, bf16] in {
22842284
def : GCNPat <
22852285
(VGPRImm<(vt fpimm)>:$imm),
2286-
(V_MOV_B16_t16_e64 0, $imm, 0)
2286+
(V_MOV_B16_t16_e64 0, (vt (bitcast_fpimm_to_i16 $imm)), 0)
22872287
>;
22882288
}
22892289
}

0 commit comments

Comments
 (0)