This PR resolves the issue that SPIR-V Backend uses the notion of a pointer size of the target, most notably, in legalizer code, but Tablegen instruction selection in SPIR-V Backend doesn't account for a pointer size of the target. See https://github.com/llvm/llvm-project/issues/88723 for a detailed description. There are 3 test cases attached to the PR that reproduced the issue, when dealing with spirv32-spirv64 differences, and are working correctly now with this PR.
17 lines
637 B
LLVM
17 lines
637 B
LLVM
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; CHECK-SPIRV: OpSelect
|
|
|
|
;; LLVM IR was generated with -cl-std=c++ option
|
|
|
|
define spir_kernel void @test(i32 %op1, i32 %op2) {
|
|
entry:
|
|
%0 = trunc i8 undef to i1
|
|
%call = call spir_func i32 @_Z14__spirv_Selectbii(i1 zeroext %0, i32 %op1, i32 %op2)
|
|
ret void
|
|
}
|
|
|
|
declare spir_func i32 @_Z14__spirv_Selectbii(i1 zeroext, i32, i32)
|