llvm-project/llvm/test/CodeGen/PowerPC/reduce_scalarization.ll
Amy Kwan 351a0d8a90 [PowerPC] Update PC-Relative Load/Store Patterns to use the refactored Load/Store Implementation
This patch updates the PC-Relative load and store patterns to utilize the
refactored load/store implementation introduced in D93370.

PC-Relative implementation has been added to PPCISelLowering.cpp, and also the
patterns in PPCInstrPrefix.td have been updated and no longer require AddedComplexity.
All existing test cases pass with this update.

Differential Revision: https://reviews.llvm.org/D95116
2021-09-09 15:38:42 -05:00

111 lines
4.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \
; RUN: -mcpu=pwr9 -ppc-asm-full-reg-names \
; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-unknown \
; RUN: -mcpu=pwr9 -ppc-asm-full-reg-names \
; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
; RUN: < %s | FileCheck %s --check-prefixes=CHECK,CHECK-P10
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-unknown \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
; RUN: < %s | FileCheck %s --check-prefixes=CHECK,CHECK-P10-BE
; Function Attrs: norecurse nounwind readonly
define dso_local <2 x double> @test1(<2 x float>* nocapture readonly %Ptr) {
; CHECK-LABEL: test1:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: lfd f0, 0(r3)
; CHECK-NEXT: xxmrghw vs0, vs0, vs0
; CHECK-NEXT: xvcvspdp v2, vs0
; CHECK-NEXT: blr
entry:
%0 = load <2 x float>, <2 x float>* %Ptr, align 8
%1 = fpext <2 x float> %0 to <2 x double>
ret <2 x double> %1
}
; Function Attrs: norecurse nounwind readonly
define dso_local <2 x double> @test2(<2 x float>* nocapture readonly %a, <2 x float>* nocapture readonly %b) {
; CHECK-LABEL: test2:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: lfd f0, 0(r4)
; CHECK-NEXT: lfd f1, 0(r3)
; CHECK-NEXT: xvsubsp vs0, vs1, vs0
; CHECK-NEXT: xxmrghw vs0, vs0, vs0
; CHECK-NEXT: xvcvspdp v2, vs0
; CHECK-NEXT: blr
entry:
%0 = load <2 x float>, <2 x float>* %a, align 8
%1 = load <2 x float>, <2 x float>* %b, align 8
%sub = fsub <2 x float> %0, %1
%2 = fpext <2 x float> %sub to <2 x double>
ret <2 x double> %2
}
; Function Attrs: norecurse nounwind readonly
; Function Attrs: norecurse nounwind readonly
define dso_local <2 x double> @test3(<2 x float>* nocapture readonly %a, <2 x float>* nocapture readonly %b) {
; CHECK-LABEL: test3:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: lfd f0, 0(r4)
; CHECK-NEXT: lfd f1, 0(r3)
; CHECK-NEXT: xvaddsp vs0, vs1, vs0
; CHECK-NEXT: xxmrghw vs0, vs0, vs0
; CHECK-NEXT: xvcvspdp v2, vs0
; CHECK-NEXT: blr
entry:
%0 = load <2 x float>, <2 x float>* %a, align 8
%1 = load <2 x float>, <2 x float>* %b, align 8
%sub = fadd <2 x float> %0, %1
%2 = fpext <2 x float> %sub to <2 x double>
ret <2 x double> %2
}
; Function Attrs: norecurse nounwind readonly
; Function Attrs: norecurse nounwind readonly
define dso_local <2 x double> @test4(<2 x float>* nocapture readonly %a, <2 x float>* nocapture readonly %b) {
; CHECK-LABEL: test4:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: lfd f0, 0(r4)
; CHECK-NEXT: lfd f1, 0(r3)
; CHECK-NEXT: xvmulsp vs0, vs1, vs0
; CHECK-NEXT: xxmrghw vs0, vs0, vs0
; CHECK-NEXT: xvcvspdp v2, vs0
; CHECK-NEXT: blr
entry:
%0 = load <2 x float>, <2 x float>* %a, align 8
%1 = load <2 x float>, <2 x float>* %b, align 8
%sub = fmul <2 x float> %0, %1
%2 = fpext <2 x float> %sub to <2 x double>
ret <2 x double> %2
}
@G = dso_local local_unnamed_addr global <2 x float> <float 3.000000e+00, float 0x3FF3333340000000>, align 8
; Function Attrs: mustprogress nofree norecurse nosync nounwind readonly uwtable willreturn
define dso_local <2 x double> @test5(<2 x double> %a) {
; CHECK-P10-LABEL: test5:
; CHECK-P10: # %bb.0: # %entry
; CHECK-P10-NEXT: plfd f0, G@PCREL(0), 1
; CHECK-P10-NEXT: xxmrghw vs0, vs0, vs0
; CHECK-P10-NEXT: xvcvspdp vs0, vs0
; CHECK-P10-NEXT: xvadddp v2, vs0, v2
; CHECK-P10-NEXT: blr
;
; CHECK-P10-BE-LABEL: test5:
; CHECK-P10-BE: # %bb.0: # %entry
; CHECK-P10-BE-NEXT: addis r3, r2, G@toc@ha
; CHECK-P10-BE-NEXT: lfd f0, G@toc@l(r3)
; CHECK-P10-BE-NEXT: xxmrghw vs0, vs0, vs0
; CHECK-P10-BE-NEXT: xvcvspdp vs0, vs0
; CHECK-P10-BE-NEXT: xvadddp v2, vs0, v2
; CHECK-P10-BE-NEXT: blr
entry:
%0 = load <2 x float>, <2 x float>* @G, align 8
%1 = fpext <2 x float> %0 to <2 x double>
%add = fadd <2 x double> %1, %a
ret <2 x double> %add
}