1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s 2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} 3 4; Make sure lowering is correctly generating spirv code. 5 6; CHECK-DAG: %[[#double:]] = OpTypeFloat 64 7; CHECK-DAG: %[[#vec_2_double:]] = OpTypeVector %[[#double]] 2 8; CHECK-DAG: %[[#int_32:]] = OpTypeInt 32 0 9; CHECK-DAG: %[[#vec_2_int_32:]] = OpTypeVector %[[#int_32]] 2 10; CHECK-DAG: %[[#vec_4_int_32:]] = OpTypeVector %[[#int_32]] 4 11 12 13define spir_func noundef i32 @test_scalar(double noundef %D) local_unnamed_addr { 14entry: 15 ; CHECK-LABEL: ; -- Begin function test_scalar 16 ; CHECK: %[[#param:]] = OpFunctionParameter %[[#double]] 17 ; CHECK: %[[#bitcast:]] = OpBitcast %[[#vec_2_int_32]] %[[#param]] 18 %0 = bitcast double %D to <2 x i32> 19 ; CHECK: %[[#]] = OpCompositeExtract %[[#int_32]] %[[#bitcast]] 0 20 %1 = extractelement <2 x i32> %0, i64 0 21 ; CHECK: %[[#]] = OpCompositeExtract %[[#int_32]] %[[#bitcast]] 1 22 %2 = extractelement <2 x i32> %0, i64 1 23 %add = add i32 %1, %2 24 ret i32 %add 25} 26 27 28define spir_func noundef <2 x i32> @test_vector(<2 x double> noundef %D) local_unnamed_addr { 29entry: 30 ; CHECK-LABEL: ; -- Begin function test_vector 31 ; CHECK: %[[#param:]] = OpFunctionParameter %[[#vec_2_double]] 32 ; CHECK: %[[#CAST1:]] = OpBitcast %[[#vec_4_int_32]] %[[#param]] 33 ; CHECK: %[[#SHUFF2:]] = OpVectorShuffle %[[#vec_2_int_32]] %[[#CAST1]] %[[#]] 0 2 34 ; CHECK: %[[#SHUFF3:]] = OpVectorShuffle %[[#vec_2_int_32]] %[[#CAST1]] %[[#]] 1 3 35 %0 = bitcast <2 x double> %D to <4 x i32> 36 %1 = shufflevector <4 x i32> %0, <4 x i32> poison, <2 x i32> <i32 0, i32 2> 37 %2 = shufflevector <4 x i32> %0, <4 x i32> poison, <2 x i32> <i32 1, i32 3> 38 %add = add <2 x i32> %1, %2 39 ret <2 x i32> %add 40} 41