File: builtins-ppc-xlcompat.c

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (54 lines) | stat: -rw-r--r-- 2,856 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -flax-vector-conversions=none -no-opaque-pointers -target-feature +altivec -target-feature +vsx \
// RUN:   -triple powerpc64-unknown-linux-gnu -emit-llvm %s -o - \
// RUN:   -D__XL_COMPAT_ALTIVEC__ -target-cpu pwr7 | FileCheck %s
// RUN: %clang_cc1 -flax-vector-conversions=none -no-opaque-pointers -target-feature +altivec -target-feature +vsx \
// RUN:   -triple powerpc64le-unknown-linux-gnu -emit-llvm %s -o - \
// RUN:   -D__XL_COMPAT_ALTIVEC__ -target-cpu pwr8 | FileCheck %s
// RUN: %clang_cc1 -flax-vector-conversions=none -no-opaque-pointers -target-feature +altivec -target-feature +vsx \
// RUN:   -triple powerpc64le-unknown-linux-gnu -emit-llvm %s -o - \
// RUN:   -U__XL_COMPAT_ALTIVEC__ -target-cpu pwr8 | FileCheck \
// RUN:   --check-prefix=NOCOMPAT %s
#include <altivec.h>
vector double vd = { 3.4e22, 1.8e-3 };
vector signed long long res_vsll, vsll = { -12345678999ll, 12345678999 };
vector unsigned long long res_vull, vull = { 11547229456923630743llu, 18014402265226391llu };
vector float res_vf;
vector double res_vd;
vector signed int res_vsi;
vector unsigned int res_vui;

void test() {
// CHECK-LABEL: @test(
// CHECK-NEXT:  entry:
// CHECK-LE-LABEL: @test(
// CHECK-LE-NEXT:  entry:

  res_vf = vec_ctf(vsll, 4);
// CHECK:         [[TMP0:%.*]] = load <2 x i64>, <2 x i64>* @vsll, align 16
// CHECK-NEXT:    [[TMP1:%.*]] = call <4 x float> @llvm.ppc.vsx.xvcvsxdsp(<2 x i64> [[TMP0]])
// CHECK-NEXT:    fmul <4 x float> [[TMP1]], <float 6.250000e-02, float 6.250000e-02, float 6.250000e-02, float 6.250000e-02>

  res_vf = vec_ctf(vull, 4);
// CHECK:         [[TMP2:%.*]] = load <2 x i64>, <2 x i64>* @vull, align 16
// CHECK-NEXT:    [[TMP3:%.*]] = call <4 x float> @llvm.ppc.vsx.xvcvuxdsp(<2 x i64> [[TMP2]])
// CHECK-NEXT:    fmul <4 x float> [[TMP3]], <float 6.250000e-02, float 6.250000e-02, float 6.250000e-02, float 6.250000e-02>

  res_vsll = vec_cts(vd, 4);
// CHECK:         [[TMP4:%.*]] = load <2 x double>, <2 x double>* @vd, align 16
// CHECK-NEXT:    fmul <2 x double> [[TMP4]], <double 1.600000e+01, double 1.600000e+01>
// CHECK:         call <4 x i32> @llvm.ppc.vsx.xvcvdpsxws(<2 x double>

  res_vull = vec_ctu(vd, 4);
// CHECK:         [[TMP8:%.*]] = load <2 x double>, <2 x double>* @vd, align 16
// CHECK-NEXT:    fmul <2 x double> [[TMP8]], <double 1.600000e+01, double 1.600000e+01>
// CHECK:         call <4 x i32> @llvm.ppc.vsx.xvcvdpuxws(<2 x double>
// NONCOMPAT:         call <4 x i32> @llvm.ppc.vsx.xvcvdpuxws(<2 x double>

  res_vd = vec_round(vd);
// CHECK:         call double @llvm.ppc.readflm()
// CHECK:         call double @llvm.ppc.setrnd(i32 0)
// CHECK:         call <2 x double> @llvm.rint.v2f64(<2 x double>
// CHECK:         call double @llvm.ppc.setflm(double
// NOCOMPAT:      call <2 x double> @llvm.round.v2f64(<2 x double>
}