Skip to content

Commit 8eb40e4

Browse files
author
Kai Luo
committed
[PowerPC] Don't generate ST_VSR_SCAL_INT if power8-vector is disabled
Summary: In https://bugs.llvm.org/show_bug.cgi?id=45297, it fails selecting instructions for `PPCISD::ST_VSR_SCAL_INT`. The reason it generate the `PPCISD::ST_VSR_SCAL_INT` with `-power8-vector` in IR is PPC's combiner checks `hasP8Altivec` rather than `hasP8Vector`. This patch should resolve PR45297. Differential Revision: https://reviews.llvm.org/D76773
1 parent d0efd7b commit 8eb40e4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13768,7 +13768,7 @@ SDValue PPCTargetLowering::combineStoreFPToInt(SDNode *N,
1376813768
(Op1VT == MVT::i32 || Op1VT == MVT::i64 ||
1376913769
(Subtarget.hasP9Vector() && (Op1VT == MVT::i16 || Op1VT == MVT::i8)));
1377013770

13771-
if (ResVT == MVT::ppcf128 || !Subtarget.hasP8Altivec() ||
13771+
if (ResVT == MVT::ppcf128 || !Subtarget.hasP8Vector() ||
1377213772
cast<StoreSDNode>(N)->isTruncatingStore() || !ValidTypeForStoreFltAsInt)
1377313773
return SDValue();
1377413774

llvm/test/CodeGen/PowerPC/pr45297.ll

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
; RUN: not --crash llc -verify-machineinstrs \
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -verify-machineinstrs -ppc-asm-full-reg-names \
23
; RUN: -mtriple=powerpc64le-unknown-linux-gnu -mattr=+altivec \
34
; RUN: -mattr=-power8-vector -mattr=-vsx < %s 2>&1 | FileCheck %s
4-
; CHECK: LLVM ERROR: Cannot select: {{.*}}: ch = PPCISD::ST_VSR_SCAL_INT<(store 4 into @Global)>
55

66
@Global = dso_local global i32 55, align 4
77

88
define dso_local void @test(float %0) local_unnamed_addr {
9+
; CHECK-LABEL: test:
10+
; CHECK: # %bb.0: # %entry
11+
; CHECK-NEXT: fctiwz f0, f1
12+
; CHECK-NEXT: addi r3, r1, -4
13+
; CHECK-NEXT: addis r4, r2, Global@toc@ha
14+
; CHECK-NEXT: stfiwx f0, 0, r3
15+
; CHECK-NEXT: lwz r3, -4(r1)
16+
; CHECK-NEXT: stw r3, Global@toc@l(r4)
17+
; CHECK-NEXT: blr
918
entry:
1019
%1 = fptosi float %0 to i32
1120
store i32 %1, i32* @Global, align 4

0 commit comments

Comments
 (0)