Skip to content

Commit 3f52576

Browse files
authored
Add round-trip tests through SPIR-V backend for previously failing tests (#3660)
Round trip for corresponding CHECK-LLVM is already working for some tests. So they could be enabled
1 parent 13f1c79 commit 3f52576

File tree

7 files changed

+30
-4
lines changed

7 files changed

+30
-4
lines changed

test/constexpr_phi.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
; RUN: llvm-spirv -r %t.spv -o %t.r.bc
55
; RUN: llvm-dis %t.r.bc -o %t.r.ll
66
; RUN: FileCheck < %t.r.ll %s --check-prefix=CHECK-LLVM
7+
; RUN: %if spirv-backend %{ llc -O0 -mtriple=spirv32-unknown-unknown -filetype=obj %s -o %t.llc.spv %}
8+
; RUN: %if spirv-backend %{ llvm-spirv -r %t.llc.spv -o %t.llc.rev.bc %}
9+
; RUN: %if spirv-backend %{ llvm-dis %t.llc.rev.bc -o %t.llc.rev.ll %}
10+
; RUN: %if spirv-backend %{ FileCheck %s --check-prefix=CHECK-LLVM < %t.llc.rev.ll %}
711

812
; CHECK-SPIRV: Name [[#F:]] "_Z3runiiPi"
913

test/local_var_keeps_external.ll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
33
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
44
; RUN: FileCheck < %t.rev.ll %s --check-prefix CHECK-LLVM
5-
; FIXME: FILECHECK_FAIL during llvm-spirv -r in llc compilation flow
5+
; RUN: %if spirv-backend %{ llc -O0 -mtriple=spirv64-unknown-unknown -filetype=obj %s -o %t.llc.spv %}
6+
; RUN: %if spirv-backend %{ llvm-spirv -r %t.llc.spv -o %t.llc.rev.bc %}
7+
; RUN: %if spirv-backend %{ llvm-dis %t.llc.rev.bc -o %t.llc.rev.ll %}
8+
; RUN: %if spirv-backend %{ FileCheck %s --input-file %t.llc.rev.ll -check-prefix=CHECK-LLVM %}
69

710
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1"
811
target triple = "spir64-unknown-unknown"

test/relationals.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
; RUN: spirv-val %t.spv
55
; RUN: llvm-spirv %t.spv -r --spirv-target-env=SPV-IR -o %t.rev.bc
66
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-LLVM
7+
; RUN: %if spirv-backend %{ llc -O0 -mtriple=spirv32-unknown-unknown -filetype=obj %s -o %t.llc.spv %}
8+
; RUN: %if spirv-backend %{ llvm-spirv -r --spirv-target-env=SPV-IR %t.llc.spv -o %t.llc.rev.bc %}
9+
; RUN: %if spirv-backend %{ llvm-dis %t.llc.rev.bc -o %t.llc.rev.ll %}
10+
; RUN: %if spirv-backend %{ FileCheck %s --check-prefix=CHECK-SPV-LLVM < %t.llc.rev.ll %}
711

812
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
913
target triple = "spir"

test/transcoding/builtin_vars_arithmetics.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
; Check that produced builtin-call-based SPV-IR is recognized by the translator
1111
; RUN: llvm-spirv %t.rev.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
12+
; RUN: %if spirv-backend %{ llc -O0 -mtriple=spirv64-unknown-unknown -filetype=obj %s -o %t.llc.spv %}
13+
; RUN: %if spirv-backend %{ llvm-spirv -r --spirv-target-env=SPV-IR %t.llc.spv -o %t.llc.rev.bc %}
14+
; RUN: %if spirv-backend %{ llvm-dis %t.llc.rev.bc -o %t.llc.rev.ll %}
15+
; RUN: %if spirv-backend %{ FileCheck %s --check-prefixes=CHECK-LLVM,CHECK-LLVM-SPV < %t.llc.rev.ll %}
1216

1317
; The IR was generated from the following source:
1418
; #include <CL/sycl.hpp>

test/transcoding/builtin_vars_opt.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
; Check that produced builtin-call-based SPV-IR is recognized by the translator
1111
; RUN: llvm-spirv %t.rev.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
12+
; RUN: %if spirv-backend %{ llc -O0 -mtriple=spirv64-unknown-unknown -filetype=obj %s -o %t.llc.spv %}
13+
; RUN: %if spirv-backend %{ llvm-spirv -r --spirv-target-env=SPV-IR %t.llc.spv -o %t.llc.rev.bc %}
14+
; RUN: %if spirv-backend %{ llvm-dis %t.llc.rev.bc -o %t.llc.rev.ll %}
15+
; RUN: %if spirv-backend %{ FileCheck %s --check-prefixes=CHECK-LLVM,CHECK-LLVM-SPV < %t.llc.rev.ll %}
1216

1317
; The IR was generated from the following source:
1418
; #include <CL/sycl.hpp>

test/transcoding/float16.ll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-EXT
1414
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
1515
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM
16+
; RUN: %if spirv-backend %{ llc -O0 -mtriple=spirv64-unknown-unknown -filetype=obj %s -o %t.llc.spv %}
17+
; RUN: %if spirv-backend %{ llvm-spirv -r %t.llc.spv -o %t.llc.rev.bc %}
18+
; RUN: %if spirv-backend %{ llvm-dis %t.llc.rev.bc -o %t.llc.rev.ll %}
19+
; RUN: %if spirv-backend %{ FileCheck %s --check-prefix=CHECK-LLVM < %t.llc.rev.ll %}
1620

1721
source_filename = "math_builtin_float_half.cpp"
1822
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
@@ -32,8 +36,8 @@ target triple = "spirv64-unknown-unknown"
3236

3337
; CHECK-LLVM: %addr = alloca half
3438
; CHECK-LLVM: %addr2 = alloca <2 x half>
35-
; CHECK-LLVM: %res = call spir_func half @_Z5fractDhPDh(half 0xH39C4, ptr %addr)
36-
; CHECK-LLVM: %res2 = call spir_func <2 x half> @_Z5fractDv2_DhPS_(<2 x half> <half 0xH39C4, half 0xH0000>, ptr %addr2)
39+
; CHECK-LLVM: %{{[a-z0-9]+}} = call spir_func half @_Z5fractDhPDh(half 0xH39C4, ptr %addr)
40+
; CHECK-LLVM: %{{[a-z0-9]+}} = call spir_func <2 x half> @_Z5fractDv2_DhPS_(<2 x half> <half 0xH39C4, half 0xH0000>, ptr %addr2)
3741

3842
define spir_kernel void @test() {
3943
entry:

test/transcoding/spirv-private-array-initialization.ll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
44
; RUN: llvm-spirv -r %t.spv -o %t_4mspirv.bc
55
; RUN: llvm-dis %t_4mspirv.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM
6-
; FIXME: FILECHECK_FAIL during llvm-spirv -r in llc compilation flow
6+
; RUN: %if spirv-backend %{ llc -O0 -mtriple=spirv32-unknown-unknown -filetype=obj %s -o %t.llc.spv %}
7+
; RUN: %if spirv-backend %{ llvm-spirv -r %t.llc.spv -o %t.llc.rev.bc %}
8+
; RUN: %if spirv-backend %{ llvm-dis %t.llc.rev.bc -o %t.llc.rev.ll %}
9+
; RUN: %if spirv-backend %{ FileCheck %s --input-file %t.llc.rev.ll -check-prefix=CHECK-LLVM %}
710
;
811
; CHECK-SPIRV-DAG: TypeInt [[i32:[0-9]+]] 32 0
912
; CHECK-SPIRV-DAG: Constant [[i32]] [[one:[0-9]+]] 1

0 commit comments

Comments
 (0)