Skip to content

Commit 86976e4

Browse files
authored
Address issue #1548 after removal most of constant expressions in LLVM (#1644)
- Rewrote test cases that were using float operations (`fadd`) to the supported instructions. - Removed vector-metadata-constexpr.ll in favor of complex-constexpr-vector.ll, because it has both LLVM and SPIRV code checks.
1 parent c5954a1 commit 86976e4

File tree

2 files changed

+42
-146
lines changed

2 files changed

+42
-146
lines changed

test/complex-constexpr-vector.ll

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,66 @@
66
; RUN: llvm-dis %t.rev.bc
77
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM
88

9-
; TODO: update or remove test following deprecation of float binop constant expressions.
10-
; XFAIL: *
11-
129
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"
1310
target triple = "spir64"
1411

1512
define linkonce_odr hidden spir_func void @foo() {
1613
entry:
17-
; CHECK-SPIRV-DAG: Constant [[#]] [[#CONSTANT1:]] 65793
18-
; CHECK-SPIRV-DAG: Constant [[#]] [[#CONSTANT2:]] 131586
1914

20-
; CHECK-SPIRV: ConstantComposite [[#]] [[#COMPOS0:]] [[#CONSTANT1]]
21-
; 124 is OpBitcast opcode
22-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#BITCAST_RES0:]] 124 [[#COMPOS0]]
15+
; CHECK-SPIRV: Constant [[#]] [[#CONSTANT1:]] 65793
2316

2417
; 81 is OpCompositeExtract opcode
25-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#EXTRACT_RES0:]] 81 [[#BITCAST_RES0]] 0
26-
; CHECK-SPIRV: ConstantComposite [[#]] [[#COMPOS1:]] [[#CONSTANT2]]
18+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER1_EXTRACT1:]] 81 [[#MEMBER1_EXTRACT1_BITCAST:]] 0
19+
; CHECK-SPIRV: Constant [[#]] [[#CONSTANT2:]] 131586
20+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER1_EXTRACT2:]] 81 [[#MEMBER1_EXTRACT2_BITCAST:]] 0
21+
; 128 is OpIAdd opcode
22+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_1:]] 128 [[#MEMBER1_EXTRACT1]] [[#MEMBER1_EXTRACT2]]
2723

28-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#BITCAST_RES1:]] 124 [[#COMPOS1]]
29-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#EXTRACT_RES1:]] 81 [[#BITCAST_RES1]] 0
30-
; 129 is OpFAdd opcode
31-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_1:]] 129 [[#EXTRACT_RES0:]] [[#EXTRACT_RES1]]
24+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER2_EXTRACT1:]] 81 [[#MEMBER1_EXTRACT1_BITCAST]] 1
25+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER2_EXTRACT2:]] 81 [[#MEMBER1_EXTRACT2_BITCAST]] 1
26+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_2:]] 128 [[#MEMBER2_EXTRACT1]] [[#MEMBER2_EXTRACT2]]
3227

33-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#EXTRACT_RES2:]] 81 [[#BITCAST_RES0]] 1
34-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#EXTRACT_RES3:]] 81 [[#BITCAST_RES1]] 1
35-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_2:]] 129 [[#EXTRACT_RES2]] [[#EXTRACT_RES3]]
28+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER3_EXTRACT1:]] 81 [[#MEMBER1_EXTRACT1_BITCAST]] 2
29+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER3_EXTRACT2:]] 81 [[#MEMBER1_EXTRACT2_BITCAST]] 2
30+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_3:]] 128 [[#MEMBER3_EXTRACT1]] [[#MEMBER3_EXTRACT2]]
31+
; CHECK-SPIRV: Undef [[#]] [[#MEMBER_4:]]
3632

37-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#BITCAST_RES2:]] 81 [[#BITCAST_RES0]] 2
38-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#BITCAST_RES2:]] 81 [[#BITCAST_RES1]] 2
39-
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_3:]] 129 [[#]] [[#BITCAST_RES2]]
33+
; CHECK-SPIRV: ConstantComposite [[#]] [[#COMPOS1:]] [[#CONSTANT1]] [[#CONSTANT1]]
34+
; 124 is OpBitcast opcode
35+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER1_EXTRACT1_BITCAST]] 124 [[#COMPOS1]]
36+
37+
; CHECK-SPIRV: ConstantComposite [[#]] [[#COMPOS2:]] [[#CONSTANT2]] [[#CONSTANT2]]
38+
; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER1_EXTRACT2_BITCAST]] 124 [[#COMPOS2]]
4039

41-
; CHECK-SPIRV: Undef [[#]] [[#MEMBER_4:]]
4240
; CHECK-SPIRV: ConstantComposite [[#]] [[#FINAL_COMPOS:]] [[#MEMBER_1]] [[#MEMBER_2]] [[#MEMBER_3]] [[#MEMBER_4]]
4341
; CHECK-SPIRV: DebugValue [[#]] [[#FINAL_COMPOS]]
4442

43+
4544
; CHECK-LLVM: call void @llvm.dbg.value(
46-
; CHECK-LLVM-SAME: metadata <4 x half> <
47-
; CHECK-LLVM-SAME: half fadd (
48-
; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 0),
49-
; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 0)),
50-
; CHECK-LLVM-SAME: half fadd (
51-
; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 1),
52-
; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 1)),
53-
; CHECK-LLVM-SAME: half fadd (
54-
; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 2),
55-
; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 2)),
56-
; CHECK-LLVM-SAME: half undef>,
45+
; CHECK-LLVM-SAME: metadata <4 x i8> <
46+
; CHECK-LLVM-SAME: i8 add (
47+
; CHECK-LLVM-SAME: i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 65793, i32 65793> to <8 x i8>), i32 0),
48+
; CHECK-LLVM-SAME: i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 131586, i32 131586> to <8 x i8>), i32 0)),
49+
; CHECK-LLVM-SAME: i8 add (
50+
; CHECK-LLVM-SAME: i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 65793, i32 65793> to <8 x i8>), i32 1),
51+
; CHECK-LLVM-SAME: i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 131586, i32 131586> to <8 x i8>), i32 1)),
52+
; CHECK-LLVM-SAME: i8 add (
53+
; CHECK-LLVM-SAME: i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 65793, i32 65793> to <8 x i8>), i32 2),
54+
; CHECK-LLVM-SAME: i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 131586, i32 131586> to <8 x i8>), i32 2)),
55+
; CHECK-LLVM-SAME: i8 undef>,
5756
; CHECK-LLVM-SAME: metadata ![[#]], metadata !DIExpression()), !dbg ![[#]]
5857
call void @llvm.dbg.value(
59-
metadata <4 x half> <
60-
half fadd (
61-
half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 0),
62-
half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 0)),
63-
half fadd (
64-
half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 1),
65-
half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 1)),
66-
half fadd (
67-
half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 2),
68-
half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 2)),
69-
half undef>,
58+
metadata <4 x i8> <
59+
i8 add (
60+
i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 65793, i32 65793> to <8 x i8>), i32 0),
61+
i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 131586, i32 131586> to <8 x i8>), i32 0)),
62+
i8 add (
63+
i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 65793, i32 65793> to <8 x i8>), i32 1),
64+
i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 131586, i32 131586> to <8 x i8>), i32 1)),
65+
i8 add (
66+
i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 65793, i32 65793> to <8 x i8>), i32 2),
67+
i8 extractelement (<8 x i8> bitcast (<2 x i32> <i32 131586, i32 131586> to <8 x i8>), i32 2)),
68+
i8 undef>,
7069
metadata !12, metadata !DIExpression()), !dbg !7
7170
ret void
7271
}

test/vector-metadata-constexpr.ll

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)