99 lines · plain
1; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=+vsx -O0 -fast-isel=0 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s2target datalayout = "E-m:e-i64:64-n32:64"3target triple = "powerpc64-unknown-linux-gnu"4 5@vf = global <4 x float> <float -1.500000e+00, float 2.500000e+00, float -3.500000e+00, float 4.500000e+00>, align 166@vd = global <2 x double> <double 3.500000e+00, double -7.500000e+00>, align 167@d = global double 2.340000e+01, align 88@vf1 = common global <4 x float> zeroinitializer, align 169@vd1 = common global <2 x double> zeroinitializer, align 1610@vf2 = common global <4 x float> zeroinitializer, align 1611@vf3 = common global <4 x float> zeroinitializer, align 1612@vd2 = common global <2 x double> zeroinitializer, align 1613@vf4 = common global <4 x float> zeroinitializer, align 1614@d1 = common global double 0.000000e+00, align 815@d2 = common global double 0.000000e+00, align 816 17; Function Attrs: nounwind18define void @test1() #0 {19; CHECK-LABEL: @test120entry:21 %0 = load volatile <4 x float>, ptr @vf, align 1622 %1 = load volatile <4 x float>, ptr @vf, align 1623 %2 = tail call <4 x float> @llvm.ppc.vsx.xvmaxsp(<4 x float> %0, <4 x float> %1)24; CHECK: xvmaxsp25 store <4 x float> %2, ptr @vf1, align 1626 %3 = load <2 x double>, ptr @vd, align 1627 %4 = tail call <2 x double> @llvm.ppc.vsx.xvmaxdp(<2 x double> %3, <2 x double> %3)28; CHECK: xvmaxdp29 store <2 x double> %4, ptr @vd1, align 1630 %5 = load volatile <4 x float>, ptr @vf, align 1631 %6 = load volatile <4 x float>, ptr @vf, align 1632 %7 = tail call <4 x float> @llvm.ppc.vsx.xvmaxsp(<4 x float> %5, <4 x float> %6)33; CHECK: xvmaxsp34 store <4 x float> %7, ptr @vf2, align 1635 %8 = load volatile <4 x float>, ptr @vf, align 1636 %9 = load volatile <4 x float>, ptr @vf, align 1637 %10 = tail call <4 x float> @llvm.ppc.vsx.xvminsp(<4 x float> %8, <4 x float> %9)38; CHECK: xvminsp39 store <4 x float> %10, ptr @vf3, align 1640 %11 = load <2 x double>, ptr @vd, align 1641 %12 = tail call <2 x double> @llvm.ppc.vsx.xvmindp(<2 x double> %11, <2 x double> %11)42; CHECK: xvmindp43 store <2 x double> %12, ptr @vd2, align 1644 %13 = load volatile <4 x float>, ptr @vf, align 1645 %14 = load volatile <4 x float>, ptr @vf, align 1646 %15 = tail call <4 x float> @llvm.ppc.vsx.xvminsp(<4 x float> %13, <4 x float> %14)47; CHECK: xvminsp48 store <4 x float> %15, ptr @vf4, align 1649 %16 = load double, ptr @d, align 850 %17 = tail call double @llvm.ppc.vsx.xsmaxdp(double %16, double %16)51; CHECK: xsmaxdp52 store double %17, ptr @d1, align 853 %18 = tail call double @llvm.ppc.vsx.xsmindp(double %16, double %16)54; CHECK: xsmindp55 store double %18, ptr @d2, align 856 ret void57}58 59; Function Attrs: nounwind readnone60declare double @llvm.ppc.vsx.xsmaxdp(double, double)61 62; Function Attrs: nounwind readnone63declare double @llvm.ppc.vsx.xsmindp(double, double)64 65; Function Attrs: nounwind readnone66declare <4 x float> @llvm.ppc.vsx.xvminsp(<4 x float>, <4 x float>)67 68; Function Attrs: nounwind readnone69declare <2 x double> @llvm.ppc.vsx.xvmindp(<2 x double>, <2 x double>)70 71; Function Attrs: nounwind readnone72declare <4 x float> @llvm.ppc.vsx.xvmaxsp(<4 x float>, <4 x float>)73 74; Function Attrs: nounwind readnone75declare <2 x double> @llvm.ppc.vsx.xvmaxdp(<2 x double>, <2 x double>)76 77; Generated from C source:78 79; % clang -O1 -maltivec -mvsx -S -emit-llvm vsx-minmax.c80;81;volatile vector float vf = { -1.5, 2.5, -3.5, 4.5 };82;vector double vd = { 3.5, -7.5 };83;double d = 23.4;84;85;vector float vf1, vf2, vf3, vf4;86;vector double vd1, vd2;87;double d1, d2;88;89;void test1() {90; vf1 = vec_max(vf, vf);91; vd1 = vec_max(vd, vd);92; vf2 = vec_vmaxfp(vf, vf);93; vf3 = vec_min(vf, vf);94; vd2 = vec_min(vd, vd);95; vf4 = vec_vminfp(vf, vf);96; d1 = __builtin_vsx_xsmaxdp(d, d);97; d2 = __builtin_vsx_xsmindp(d, d);98;}99