
This PR contains changes in virtual register processing aimed to improve correctness of emitted MIR between passes from the perspective of MachineVerifier. This potentially helps to detect previously missed flaws in code emission and harden the test suite. As a measure of correctness and usefulness of this PR we may use a mode with expensive checks set on, and MachineVerifier reports problems in the test suite. In order to satisfy Machine Verifier requirements to MIR correctness not only a rework of usage of virtual registers' types and classes is required, but also corrections into pre-legalizer and instruction selection logics. Namely, the following changes are introduced: * scalar virtual registers have proper bit width, * detect register class by SPIR-V type, * add a superclass for id virtual register classes, * fix Tablegen rules used for instruction selection, * fixes of minor existed issues (missed flag for proper representation of a null constant for OpenCL vs. HLSL, wrong usage of integer virtual registers as a synonym of any non-type virtual register).
23 lines
1.0 KiB
LLVM
23 lines
1.0 KiB
LLVM
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; CHECK-DAG: %[[#type_int32:]] = OpTypeInt 32 0
|
|
; CHECK-DAG: %[[#type_int64:]] = OpTypeInt 64 0
|
|
; CHECK-DAG: %[[#type_vec:]] = OpTypeVector %[[#type_int32]] 2
|
|
; CHECK-DAG: %[[#const1:]] = OpConstant %[[#type_int32]] 1
|
|
; CHECK-DAG: %[[#vec_const:]] = OpConstantComposite %[[#type_vec]] %[[#const1]] %[[#const1]]
|
|
; CHECK-DAG: %[[#const32:]] = OpConstant %[[#type_int64]] 32
|
|
|
|
; CHECK: %[[#bitcast_res:]] = OpBitcast %[[#type_int64]] %[[#vec_const]]
|
|
; CHECK: %[[#shift_res:]] = OpShiftRightLogical %[[#type_int64]] %[[#bitcast_res]] %[[#const32]]
|
|
|
|
define void @foo(i64* %arg) {
|
|
entry:
|
|
%0 = lshr i64 bitcast (<2 x i32> <i32 1, i32 1> to i64), 32
|
|
store i64 %0, i64* %arg
|
|
ret void
|
|
}
|