Skip to content

Commit

Permalink
[PowerPC]perform bitcast lowering only at 64 bit
Browse files Browse the repository at this point in the history
Perform bitcast lowering requires 64-bit to be native supported,
However this is not true on 32-bit targets. Explicitly require
64-bit target.

Fixes #92233
  • Loading branch information
Chen Zheng committed May 20, 2024
1 parent dd8cb3d commit 2143b7c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9338,7 +9338,7 @@ SDValue PPCTargetLowering::LowerBITCAST(SDValue Op, SelectionDAG &DAG) const {
if ((Op.getValueType() != MVT::f128) ||
(Op0.getOpcode() != ISD::BUILD_PAIR) ||
(Op0.getOperand(0).getValueType() != MVT::i64) ||
(Op0.getOperand(1).getValueType() != MVT::i64))
(Op0.getOperand(1).getValueType() != MVT::i64) || !Subtarget.isPPC64())
return SDValue();

return DAG.getNode(PPCISD::BUILD_FP128, dl, MVT::f128, Op0.getOperand(0),
Expand Down
19 changes: 19 additions & 0 deletions llvm/test/CodeGen/PowerPC/pr92233.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mcpu=pwr9 -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu | FileCheck %s

define internal fp128 @f(i128 %v) nounwind {
; CHECK-LABEL: f:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: stwu 1, -32(1)
; CHECK-NEXT: stw 6, 28(1)
; CHECK-NEXT: stw 5, 24(1)
; CHECK-NEXT: stw 4, 20(1)
; CHECK-NEXT: stw 3, 16(1)
; CHECK-NEXT: lxv 34, 16(1)
; CHECK-NEXT: addi 1, 1, 32
; CHECK-NEXT: blr
entry:
%cast = bitcast i128 %v to fp128
ret fp128 %cast
}

0 comments on commit 2143b7c

Please sign in to comment.