41 lines · plain
1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s2; 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 647; CHECK-DAG: %[[#vec_2_double:]] = OpTypeVector %[[#double]] 28; CHECK-DAG: %[[#int_32:]] = OpTypeInt 32 09; CHECK-DAG: %[[#vec_2_int_32:]] = OpTypeVector %[[#int_32]] 210; CHECK-DAG: %[[#vec_4_int_32:]] = OpTypeVector %[[#int_32]] 411 12 13define spir_func noundef i32 @test_scalar(double noundef %D) local_unnamed_addr {14entry:15 ; CHECK-LABEL: ; -- Begin function test_scalar16 ; 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]] 020 %1 = extractelement <2 x i32> %0, i64 021 ; CHECK: %[[#]] = OpCompositeExtract %[[#int_32]] %[[#bitcast]] 122 %2 = extractelement <2 x i32> %0, i64 123 %add = add i32 %1, %224 ret i32 %add25}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_vector31 ; 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 234 ; CHECK: %[[#SHUFF3:]] = OpVectorShuffle %[[#vec_2_int_32]] %[[#CAST1]] %[[#]] 1 335 %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, %239 ret <2 x i32> %add40}41