• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // REQUIRES: systemz-registered-target
2 // RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
3 // RUN: -fzvector -fno-lax-vector-conversions -std=c++11 \
4 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
5 
6 bool gb;
7 
8 // There was an issue where we weren't properly converting constexprs to
9 // vectors with elements of the appropriate width. (e.g.
10 // (vector signed short)0 would be lowered as [4 x i32] in some cases)
11 
12 // CHECK-LABEL: @_Z8testIntsDv4_i
testInts(vector int VI)13 void testInts(vector int VI) {
14   constexpr vector int CI1 = (vector int)0LL;
15   // CHECK: icmp
16   gb = (VI == CI1)[0];
17 
18   // Likewise for float inits.
19   constexpr vector int CI2 = (vector int)char(0);
20   // CHECK: icmp
21   gb = (VI == CI2)[0];
22 
23   constexpr vector int CF1 = (vector int)0.0;
24   // CHECK: icmp
25   gb = (VI == CF1)[0];
26 
27   constexpr vector int CF2 = (vector int)0.0f;
28   // CHECK: icmp
29   gb = (VI == CF2)[0];
30 }
31 
32 // CHECK-LABEL: @_Z10testFloatsDv2_d
testFloats(vector double VD)33 void testFloats(vector double VD) {
34   constexpr vector double CI1 = (vector double)0LL;
35   // CHECK: fcmp
36   gb = (VD == CI1)[0];
37 
38   // Likewise for float inits.
39   constexpr vector double CI2 = (vector double)char(0);
40   // CHECK: fcmp
41   gb = (VD == CI2)[0];
42 
43   constexpr vector double CF1 = (vector double)0.0;
44   // CHECK: fcmp
45   gb = (VD == CF1)[0];
46 
47   constexpr vector double CF2 = (vector double)0.0f;
48   // CHECK: fcmp
49   gb = (VD == CF2)[0];
50 }
51