xref: /llvm-project/clang/test/CodeGen/vector.cpp (revision fc935fc35bc2f76c4d1ec984a17e9db508a172de)
1*fc935fc3SFangrui Song // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
2*fc935fc3SFangrui Song 
3*fc935fc3SFangrui Song typedef __attribute__((__vector_size__(16))) float float4;
4*fc935fc3SFangrui Song typedef __attribute__((__vector_size__(16))) int int4;
5*fc935fc3SFangrui Song typedef __attribute__((__vector_size__(16))) unsigned int uint4;
6*fc935fc3SFangrui Song 
7*fc935fc3SFangrui Song // CHECK: @_Z5test1Dv4_j
test1(uint4 V0)8*fc935fc3SFangrui Song int4 test1(uint4 V0) {
9*fc935fc3SFangrui Song   // CHECK: [[CMP0:%.*]] = icmp eq <4 x i32> [[V0:%.*]], zeroinitializer
10*fc935fc3SFangrui Song   // CHECK-NEXT: [[V1:%.*]] = sext <4 x i1> [[CMP0]] to <4 x i32>
11*fc935fc3SFangrui Song   int4 V = !V0;
12*fc935fc3SFangrui Song   return V;
13*fc935fc3SFangrui Song }
14*fc935fc3SFangrui Song 
15*fc935fc3SFangrui Song // CHECK: @_Z5test2Dv4_fS_
test2(float4 V0,float4 V1)16*fc935fc3SFangrui Song int4 test2(float4 V0, float4 V1) {
17*fc935fc3SFangrui Song   // CHECK: [[CMP0:%.*]] = fcmp oeq <4 x float> [[V0:%.*]], zeroinitializer
18*fc935fc3SFangrui Song   // CHECK-NEXT: [[V1:%.*]] = sext <4 x i1> [[CMP0]] to <4 x i32>
19*fc935fc3SFangrui Song   int4 V = !V0;
20*fc935fc3SFangrui Song   return V;
21*fc935fc3SFangrui Song }
22