1; Expecting validation failure
2; RUN: not rs2spirv_lit_driver.sh %s
3
4target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
5target triple = "aarch64-none-linux-gnueabi"
6
7; CHECK: OpEntryPoint GLCompute %[[WrapperId:[a-zA-Z_0-9]*]] "entry_duff"
8; CHECK: [[KernelId:%[a-zA-Z_0-9]+]] = OpFunction {{.*}}
9; Function Attrs: norecurse nounwind readnone
10define i32 @duff(i32 %count) #0 {
11entry:
12  %add = add nsw i32 %count, 7
13  %div = sdiv i32 %add, 8
14  %rem = srem i32 %count, 8
15  switch i32 %rem, label %sw.epilog [
16    i32 0, label %do.body
17    i32 7, label %sw.bb1
18    i32 6, label %sw.bb2
19    i32 5, label %sw.bb3
20    i32 4, label %sw.bb6
21    i32 3, label %sw.bb8
22    i32 2, label %sw.bb12
23    i32 1, label %sw.bb14
24  ]
25
26do.body:                                          ; preds = %entry, %sw.bb14
27  %n.0 = phi i32 [ %dec15, %sw.bb14 ], [ %div, %entry ]
28  %x.0 = phi i32 [ %shl, %sw.bb14 ], [ 321, %entry ]
29  %mul = mul nsw i32 %x.0, 5
30  br label %sw.bb1
31
32sw.bb1:                                           ; preds = %entry, %do.body
33  %n.1 = phi i32 [ %n.0, %do.body ], [ %div, %entry ]
34  %x.1 = phi i32 [ %mul, %do.body ], [ 321, %entry ]
35  %dec = add nsw i32 %x.1, -1
36  br label %sw.bb2
37
38sw.bb2:                                           ; preds = %entry, %sw.bb1
39  %n.2 = phi i32 [ %n.1, %sw.bb1 ], [ %div, %entry ]
40  %x.2 = phi i32 [ %dec, %sw.bb1 ], [ 321, %entry ]
41  %xor = xor i32 %x.2, 27
42  br label %sw.bb3
43
44sw.bb3:                                           ; preds = %entry, %sw.bb2
45  %n.3 = phi i32 [ %n.2, %sw.bb2 ], [ %div, %entry ]
46  %x.3 = phi i32 [ %xor, %sw.bb2 ], [ 321, %entry ]
47  %mul4 = mul nsw i32 %x.3, %x.3
48  %sub.neg = add i32 %x.3, 12
49  %sub5 = sub i32 %sub.neg, %mul4
50  br label %sw.bb6
51
52sw.bb6:                                           ; preds = %entry, %sw.bb3
53  %n.4 = phi i32 [ %n.3, %sw.bb3 ], [ %div, %entry ]
54  %x.4 = phi i32 [ %sub5, %sw.bb3 ], [ 321, %entry ]
55  %add7 = add nsw i32 %x.4, 2
56  br label %sw.bb8
57
58sw.bb8:                                           ; preds = %entry, %sw.bb6
59  %n.5 = phi i32 [ %n.4, %sw.bb6 ], [ %div, %entry ]
60  %x.5 = phi i32 [ %add7, %sw.bb6 ], [ 321, %entry ]
61  %rem9 = srem i32 %x.5, 32
62  %mul10 = mul nsw i32 %x.5, %x.5
63  %add11 = add nsw i32 %rem9, %mul10
64  br label %sw.bb12
65
66sw.bb12:                                          ; preds = %entry, %sw.bb8
67  %n.6 = phi i32 [ %n.5, %sw.bb8 ], [ %div, %entry ]
68  %x.6 = phi i32 [ %add11, %sw.bb8 ], [ 321, %entry ]
69  %sub13 = add nsw i32 %x.6, -2
70  br label %sw.bb14
71
72sw.bb14:                                          ; preds = %entry, %sw.bb12
73  %n.7 = phi i32 [ %div, %entry ], [ %n.6, %sw.bb12 ]
74  %x.7 = phi i32 [ 321, %entry ], [ %sub13, %sw.bb12 ]
75  %shl = shl i32 %x.7, 3
76  %dec15 = add nsw i32 %n.7, -1
77  %cmp = icmp sgt i32 %n.7, 1
78  br i1 %cmp, label %do.body, label %sw.epilog
79
80sw.epilog:                                        ; preds = %sw.bb14, %entry
81  %x.8 = phi i32 [ 321, %entry ], [ %shl, %sw.bb14 ]
82  ret i32 %x.8
83}
84
85; CHECK: %[[WrapperId]] = OpFunction {{.*}}
86; CHECK-NEXT: OpLabel
87; CHECK: %{{[0-9]+}} = OpFunctionCall %{{.*}} [[KernelId]]
88; CHECK: OpReturn
89
90attributes #0 = { norecurse nounwind readnone "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="0" "stackrealign" "unsafe-fp-math"="false" "use-soft-float"="false" }
91
92!llvm.ident = !{!0}
93!\23pragma = !{!1, !2, !3}
94!\23rs_export_foreach_name = !{!4, !5}
95!\23rs_export_foreach = !{!6, !7}
96
97!0 = !{!"Android clang version 3.8.256229  (based on LLVM 3.8.256229)"}
98!1 = !{!"version", !"1"}
99!2 = !{!"java_package_name", !"rs2spirv"}
100!3 = !{!"rs_fp_relaxed", !""}
101!4 = !{!"root"}
102!5 = !{!"duff"}
103!6 = !{!"0"}
104!7 = !{!"35"}
105