64 lines · c
1// REQUIRES: powerpc-registered-target2// RUN: %clang_cc1 -flax-vector-conversions=none -target-feature +altivec -target-feature +vsx \3// RUN: -triple powerpc64-unknown-linux-gnu -emit-llvm %s -o - \4// RUN: -D__XL_COMPAT_ALTIVEC__ -target-cpu pwr7 | FileCheck %s5// RUN: %clang_cc1 -flax-vector-conversions=none -target-feature +altivec -target-feature +vsx \6// RUN: -triple powerpc64le-unknown-linux-gnu -emit-llvm %s -o - \7// RUN: -D__XL_COMPAT_ALTIVEC__ -target-cpu pwr8 | FileCheck %s8// RUN: %clang_cc1 -flax-vector-conversions=none -target-feature +altivec -target-feature +vsx \9// RUN: -triple powerpc64le-unknown-linux-gnu -emit-llvm %s -o - \10// RUN: -U__XL_COMPAT_ALTIVEC__ -target-cpu pwr8 | FileCheck \11// RUN: --check-prefix=NOCOMPAT %s12#include <altivec.h>13vector double vd = { 3.4e22, 1.8e-3 };14vector signed long long res_vsll, vsll = { -12345678999ll, 12345678999 };15vector unsigned long long res_vull, vull = { 11547229456923630743llu, 18014402265226391llu };16vector float res_vf;17vector double res_vd;18vector signed int res_vsi;19vector unsigned int res_vui;20 21void test() {22// CHECK-LABEL: @test(23// CHECK-NEXT: entry:24// NOCOMPAT-LABEL: @test(25// NOCOMPAT-NEXT: entry:26 27 res_vf = vec_ctf(vsll, 4);28// CHECK: [[TMP0:%.*]] = load <2 x i64>, ptr @vsll, align 1629// CHECK-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.ppc.vsx.xvcvsxdsp(<2 x i64> [[TMP0]])30// CHECK-NEXT: fmul <4 x float> [[TMP1]], splat (float 6.250000e-02)31// NOCOMPAT: [[TMP0:%.*]] = load <2 x i64>, ptr @vsll, align 1632// NOCOMPAT-NEXT: [[CONV:%.*]] = sitofp <2 x i64> [[TMP0]] to <2 x double>33// NOCOMPAT-NEXT: fmul <2 x double> [[CONV]], splat (double 6.250000e-02)34 35 res_vf = vec_ctf(vull, 4);36// CHECK: [[TMP2:%.*]] = load <2 x i64>, ptr @vull, align 1637// CHECK-NEXT: [[TMP3:%.*]] = call <4 x float> @llvm.ppc.vsx.xvcvuxdsp(<2 x i64> [[TMP2]])38// CHECK-NEXT: fmul <4 x float> [[TMP3]], splat (float 6.250000e-02)39// NOCOMPAT: [[TMP2:%.*]] = load <2 x i64>, ptr @vull, align 1640// NOCOMPAT-NEXT: [[CONV1:%.*]] = uitofp <2 x i64> [[TMP2]] to <2 x double>41// NOCOMPAT-NEXT: fmul <2 x double> [[CONV1]], splat (double 6.250000e-02)42 43 res_vsll = vec_cts(vd, 4);44// CHECK: [[TMP4:%.*]] = load <2 x double>, ptr @vd, align 1645// CHECK-NEXT: fmul <2 x double> [[TMP4]], splat (double 1.600000e+01)46// CHECK: call <4 x i32> @llvm.ppc.vsx.xvcvdpsxws(<2 x double>47// NOCOMPAT: [[TMP4:%.*]] = load <2 x double>, ptr @vd, align 1648// NOCOMPAT-NEXT: fmul <2 x double> [[TMP4]], splat (double 1.600000e+01)49 50 res_vull = vec_ctu(vd, 4);51// CHECK: [[TMP8:%.*]] = load <2 x double>, ptr @vd, align 1652// CHECK-NEXT: fmul <2 x double> [[TMP8]], splat (double 1.600000e+01)53// CHECK: call <4 x i32> @llvm.ppc.vsx.xvcvdpuxws(<2 x double>54// NOCOMPAT: [[TMP7:%.*]] = load <2 x double>, ptr @vd, align 1655// NOCOMPAT-NEXT: fmul <2 x double> [[TMP7]], splat (double 1.600000e+01)56 57 res_vd = vec_round(vd);58// CHECK: call double @llvm.ppc.readflm()59// CHECK: call double @llvm.ppc.setrnd(i32 0)60// CHECK: call <2 x double> @llvm.rint.v2f64(<2 x double>61// CHECK: call double @llvm.ppc.setflm(double62// NOCOMPAT: call <2 x double> @llvm.round.v2f64(<2 x double>63}64