1//RUN: %clang_cc1 -no-opaque-pointers %s -triple spir -emit-llvm -o - -O0 | FileCheck %s 2 3typedef short short2 __attribute__((ext_vector_type(2))); 4 5int bar(const unsigned int &i); 6 7class C { 8public: 9 void bar(const short2 &); 10}; 11 12// CHECK-LABEL: define{{.*}} spir_func void @_Z6scalarv() 13void scalar() { 14 // The generic addr space reference parameter object will be bound 15 // to a temporary value allocated in private addr space. We need an 16 // addrspacecast before passing the value to the function. 17 // CHECK: [[REF:%.*]] = alloca i32 18 // CHECK: store i32 1, i32* [[REF]] 19 // CHECK: [[REG:%[.a-z0-9]+]] ={{.*}} addrspacecast i32* [[REF]] to i32 addrspace(4)* 20 // CHECK: call spir_func noundef i32 @_Z3barRU3AS4Kj(i32 addrspace(4)* noundef align 4 dereferenceable(4) [[REG]]) 21 bar(1); 22} 23 24// Test list initialization 25// CHECK-LABEL: define{{.*}} spir_func void @_Z4listv() 26void list() { 27 C c1; 28// CHECK: [[REF:%.*]] = alloca <2 x i16> 29// CHECK: store <2 x i16> <i16 1, i16 2>, <2 x i16>* [[REF]] 30// CHECK: [[REG:%[.a-z0-9]+]] = addrspacecast <2 x i16>* [[REF]] to <2 x i16> addrspace(4)* 31// CHECK: call {{.*}}void @_ZNU3AS41C3barERU3AS4KDv2_s(%class.C addrspace(4)* {{.*}}, <2 x i16> addrspace(4)*{{.*}} [[REG]]) 32 c1.bar({1, 2}); 33} 34