Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions llvm/lib/Target/AMDGPU/SIInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,11 @@ def cond_as_i32imm: SDNodeXForm<cond, [{
}]>;

// Copied from the AArch64 backend:
def bitcast_fpimm_to_i16 : SDNodeXForm<fpimm, [{
return CurDAG->getTargetConstant(
N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i16);
}]>;

def bitcast_fpimm_to_i32 : SDNodeXForm<fpimm, [{
return CurDAG->getTargetConstant(
N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i32);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/SIInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ let True16Predicate = UseRealTrue16Insts in {
foreach vt = [f16, bf16] in {
def : GCNPat <
(VGPRImm<(vt fpimm)>:$imm),
(V_MOV_B16_t16_e64 0, $imm, 0)
(V_MOV_B16_t16_e64 0, (vt (bitcast_fpimm_to_i16 $imm)), 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

The type of immediate nodes in the selected dag doesn't really matter, they're all turning into sign extended int64_t in the end anyway. We could change all of these to just use i64 in the first place

Copy link
Contributor Author

@broxigarchen broxigarchen Mar 20, 2025

Choose a reason for hiding this comment

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

Double checked in downstream branch. I think you are right.

Still merge this patch as it makes the pattern more consisitent

>;
}
}
Expand Down
Loading