Skip to content

Commit 0a7e31a

Browse files
committed
address pr comments add -verify-machineinstrs to distance.ll
Also add a MIR test to test the instcombine independent of other passes.
1 parent e27efa2 commit 0a7e31a

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# RUN: llc -verify-machineinstrs -O0 -mtriple spirv-unknown-unknown -run-pass=spirv-prelegalizer-combiner %s -o - | FileCheck %s
2+
# REQUIRES: asserts
3+
---
4+
name: distance_instcombine_float4
5+
tracksRegLiveness: true
6+
legalized: true
7+
body: |
8+
bb.1.entry:
9+
; CHECK-LABEL: name: distance_instcombine_float4
10+
; CHECK-NOT: %6:_(<4 x s32>) = G_FSUB %2, %3
11+
; CHECK-NOT: %7:id(s32) = G_INTRINSIC intrinsic(@llvm.spv.length), %6(<4 x s32>)
12+
; CHECK: %7:id(s32) = G_INTRINSIC intrinsic(@llvm.spv.distance), %2(<4 x s32>), %3(<4 x s32>)
13+
%0:type(s64) = OpTypeFloat 32
14+
%1:type(s64) = OpTypeVector %0(s64), 4
15+
OpName %2(<4 x s32>), 97
16+
OpName %3(<4 x s32>), 98
17+
%4:type(s64) = OpTypeFunction %0(s64), %1(s64), %1(s64)
18+
%5:iid(s64) = OpFunction %0(s64), 0, %4(s64)
19+
%2:vfid(<4 x s32>) = OpFunctionParameter %1(s64)
20+
%3:vfid(<4 x s32>) = OpFunctionParameter %1(s64)
21+
OpName %5(s64), 1953720676, 1701015137, 1936615775, 1836016500, 1701734754, 1869375071, 3437665
22+
OpDecorate %5(s64), 41, 1953720676, 1701015137, 1936615775, 1836016500, 1701734754, 1869375071, 3437665, 0
23+
%6:_(<4 x s32>) = G_FSUB %2, %3
24+
%7:id(s32) = G_INTRINSIC intrinsic(@llvm.spv.length), %6(<4 x s32>)
25+
OpReturnValue %7(s32)
26+

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/distance.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
1+
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
22
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
33

44
; Make sure SPIRV operation function calls for distance are lowered correctly.

0 commit comments

Comments
 (0)