1; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32 2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %} 3; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64 4; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %} 5 6; CHECK-DAG: %[[#i64:]] = OpTypeInt 64 0 7; CHECK-DAG: %[[#i8:]] = OpTypeInt 8 0 8; CHECK-DAG: %[[#i32:]] = OpTypeInt 32 0 9; CHECK-DAG: %[[#one:]] = OpConstant %[[#i32]] 1 10; CHECK-DAG: %[[#two:]] = OpConstant %[[#i32]] 2 11; CHECK-DAG: %[[#three:]] = OpConstant %[[#i32]] 3 12; CHECK-DAG: %[[#i32x3:]] = OpTypeArray %[[#i32]] %[[#three]] 13; CHECK-DAG: %[[#test_arr_init:]] = OpConstantComposite %[[#i32x3]] %[[#one]] %[[#two]] %[[#three]] 14; CHECK-DAG: %[[#szconst1024:]] = OpConstant %[[#i32]] 1024 15; CHECK-DAG: %[[#szconst42:]] = OpConstant %[[#i8]] 42 16; CHECK-DAG: %[[#szconst123:]] = OpConstant %[[#i64]] 123 17; CHECK-DAG: %[[#const_i32x3_ptr:]] = OpTypePointer UniformConstant %[[#i32x3]] 18; CHECK-DAG: %[[#test_arr:]] = OpVariable %[[#const_i32x3_ptr]] UniformConstant %[[#test_arr_init]] 19; CHECK-DAG: %[[#i32x3_ptr:]] = OpTypePointer Function %[[#i32x3]] 20; CHECK: %[[#arr:]] = OpVariable %[[#i32x3_ptr]] Function 21 22; CHECK-32: OpCopyMemorySized %[[#arr]] %[[#test_arr]] %[[#szconst1024]] 23; CHECK-32: %[[#szconstext42:]] = OpUConvert %[[#i32:]] %[[#szconst42:]] 24; CHECK-32: OpCopyMemorySized %[[#arr]] %[[#test_arr]] %[[#szconstext42]] 25; CHECK-32: OpCopyMemorySized %[[#arr]] %[[#test_arr]] %[[#szconst123]] 26 27; If/when Backend stoped rewrite actual reg size of i8/i16/i32/i64 with i32, 28; i32 = G_TRUNC i64 would appear for the 32-bit target, switching the following 29; TODO patterns instead of the last line above. 30; TODO: %[[#szconstext123:]] = OpUConvert %[[#i32:]] %[[#szconst123:]] 31; TODO: OpCopyMemorySized %[[#arr]] %[[#test_arr]] %[[#szconst123]] 32 33; CHECK-64: %[[#szconstext1024:]] = OpUConvert %[[#i64:]] %[[#szconst1024:]] 34; CHECK-64: OpCopyMemorySized %[[#arr]] %[[#test_arr]] %[[#szconstext1024]] 35; CHECK-64: %[[#szconstext42:]] = OpUConvert %[[#i64:]] %[[#szconst42:]] 36; CHECK-64: OpCopyMemorySized %[[#arr]] %[[#test_arr]] %[[#szconstext42]] 37; CHECK-64: OpCopyMemorySized %[[#arr]] %[[#test_arr]] %[[#szconst123]] 38 39@__const.test.arr = private unnamed_addr addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3] 40 41define spir_func void @test() { 42entry: 43 %arr = alloca [3 x i32], align 4 44 %dest = bitcast ptr %arr to ptr 45 call void @llvm.memcpy.p0.p2.i32(ptr align 4 %dest, ptr addrspace(2) align 4 @__const.test.arr, i32 1024, i1 false) 46 call void @llvm.memcpy.p0.p2.i8(ptr align 4 %dest, ptr addrspace(2) align 4 @__const.test.arr, i8 42, i1 false) 47 call void @llvm.memcpy.p0.p2.i64(ptr align 4 %dest, ptr addrspace(2) align 4 @__const.test.arr, i64 123, i1 false) 48 ret void 49} 50 51declare void @llvm.memcpy.p0.p2.i32(ptr nocapture writeonly, ptr addrspace(2) nocapture readonly, i32, i1) 52declare void @llvm.memcpy.p0.p2.i8(ptr nocapture writeonly, ptr addrspace(2) nocapture readonly, i8, i1) 53declare void @llvm.memcpy.p0.p2.i64(ptr nocapture writeonly, ptr addrspace(2) nocapture readonly, i64, i1) 54