1;; Check that backend converts scalar arg to vector for ldexp math instructions 2 3; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV 4 5;; #pragma OPENCL EXTENSION cl_khr_fp16 : enable 6;; #pragma OPENCL EXTENSION cl_khr_fp64 : enable 7 8;; __kernel void test_kernel_half(half3 x, int k, __global half3* ret) { 9;; *ret = ldexp(x, k); 10;; } 11 12; CHECK-SPIRV: %{{.*}} ldexp 13 14define dso_local spir_kernel void @test_kernel_half(<3 x half> noundef %x, i32 noundef %k, <3 x half> addrspace(1)* nocapture noundef writeonly %ret) local_unnamed_addr { 15entry: 16 %call = call spir_func <3 x half> @_Z5ldexpDv3_Dhi(<3 x half> noundef %x, i32 noundef %k) 17 %extractVec2 = shufflevector <3 x half> %call, <3 x half> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 undef> 18 %storetmp3 = bitcast <3 x half> addrspace(1)* %ret to <4 x half> addrspace(1)* 19 store <4 x half> %extractVec2, <4 x half> addrspace(1)* %storetmp3, align 8 20 ret void 21} 22 23declare spir_func <3 x half> @_Z5ldexpDv3_Dhi(<3 x half> noundef, i32 noundef) local_unnamed_addr 24 25;; __kernel void test_kernel_float(float3 x, int k, __global float3* ret) { 26;; *ret = ldexp(x, k); 27;; } 28 29; CHECK-SPIRV: %{{.*}} ldexp 30 31define dso_local spir_kernel void @test_kernel_float(<3 x float> noundef %x, i32 noundef %k, <3 x float> addrspace(1)* nocapture noundef writeonly %ret) local_unnamed_addr { 32entry: 33 %call = call spir_func <3 x float> @_Z5ldexpDv3_fi(<3 x float> noundef %x, i32 noundef %k) 34 %extractVec2 = shufflevector <3 x float> %call, <3 x float> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 undef> 35 %storetmp3 = bitcast <3 x float> addrspace(1)* %ret to <4 x float> addrspace(1)* 36 store <4 x float> %extractVec2, <4 x float> addrspace(1)* %storetmp3, align 16 37 ret void 38} 39 40declare spir_func <3 x float> @_Z5ldexpDv3_fi(<3 x float> noundef, i32 noundef) local_unnamed_addr 41 42;; __kernel void test_kernel_double(double3 x, int k, __global double3* ret) { 43;; *ret = ldexp(x, k); 44;; } 45 46; CHECK-SPIRV: %{{.*}} ldexp 47 48define dso_local spir_kernel void @test_kernel_double(<3 x double> noundef %x, i32 noundef %k, <3 x double> addrspace(1)* nocapture noundef writeonly %ret) local_unnamed_addr { 49entry: 50 %call = call spir_func <3 x double> @_Z5ldexpDv3_di(<3 x double> noundef %x, i32 noundef %k) 51 %extractVec2 = shufflevector <3 x double> %call, <3 x double> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 undef> 52 %storetmp3 = bitcast <3 x double> addrspace(1)* %ret to <4 x double> addrspace(1)* 53 store <4 x double> %extractVec2, <4 x double> addrspace(1)* %storetmp3, align 32 54 ret void 55} 56 57declare spir_func <3 x double> @_Z5ldexpDv3_di(<3 x double> noundef, i32 noundef) local_unnamed_addr 58