]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/AMDGPU/coalescer-subrange-crash.ll
Vendor import of llvm release_40 branch r296202:
[FreeBSD/FreeBSD.git] / test / CodeGen / AMDGPU / coalescer-subrange-crash.ll
1 ; RUN: llc -march=amdgcn < %s | FileCheck %s
2 ; REQUIRES: asserts
3 ;
4 ; This testcase used to cause the following crash:
5 ;
6 ; *** Couldn't join subrange!
7 ;
8 ; UNREACHABLE executed at lib/CodeGen/RegisterCoalescer.cpp:2666!
9 ;
10 ; The insertelement instructions became subregister definitions: one virtual
11 ; register was defined and re-defined by one group of the consecutive insert-
12 ; elements, and another was defined by the second group.
13 ; Since a copy between the two full registers was present in the program,
14 ; the coalescer tried to merge them. The join algorithm for the main range
15 ; decided that it was correct to do so, while the subrange join unexpectedly
16 ; failed. This was caused by the live interval subranges not being computed
17 ; correctly: subregister defs are not uses for the purpose of subranges.
18 ;
19 ; Test for a valid output:
20 ; CHECK: image_sample_c_d_o
21
22 target triple = "amdgcn--"
23
24 define amdgpu_ps <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> @main([17 x <16 x i8>] addrspace(2)* byval dereferenceable(18446744073709551615) %arg, [16 x <16 x i8>] addrspace(2)* byval dereferenceable(18446744073709551615) %arg1, [32 x <8 x i32>] addrspace(2)* byval dereferenceable(18446744073709551615) %arg2, [16 x <8 x i32>] addrspace(2)* byval dereferenceable(18446744073709551615) %arg3, [16 x <4 x i32>] addrspace(2)* byval dereferenceable(18446744073709551615) %arg4, float inreg %arg5, i32 inreg %arg6, <2 x i32> %arg7, <2 x i32> %arg8, <2 x i32> %arg9, <3 x i32> %arg10, <2 x i32> %arg11, <2 x i32> %arg12, <2 x i32> %arg13, float %arg14, float %arg15, float %arg16, float %arg17, float %arg18, i32 %arg19, i32 %arg20, float %arg21, i32 %arg22) #0 {
25 main_body:
26   %tmp = call float @llvm.SI.fs.interp(i32 3, i32 0, i32 %arg6, <2 x i32> %arg8)
27   %tmp23 = fadd float %tmp, 0xBFA99999A0000000
28   %tmp24 = fadd float %tmp, 0x3FA99999A0000000
29   %tmp25 = bitcast float %tmp23 to i32
30   %tmp26 = insertelement <16 x i32> <i32 212739, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>, i32 %tmp25, i32 1
31   %tmp27 = insertelement <16 x i32> %tmp26, i32 undef, i32 2
32   %tmp28 = insertelement <16 x i32> %tmp27, i32 undef, i32 3
33   %tmp29 = insertelement <16 x i32> %tmp28, i32 undef, i32 4
34   %tmp30 = insertelement <16 x i32> %tmp29, i32 0, i32 5
35   %tmp31 = insertelement <16 x i32> %tmp30, i32 undef, i32 6
36   %tmp32 = insertelement <16 x i32> %tmp31, i32 undef, i32 7
37   %tmp33 = insertelement <16 x i32> %tmp32, i32 undef, i32 8
38   %tmp34 = call <4 x float> @llvm.SI.image.sample.c.d.o.v16i32(<16 x i32> %tmp33, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0)
39   %tmp35 = extractelement <4 x float> %tmp34, i32 0
40   %tmp36 = bitcast float %tmp24 to i32
41   %tmp37 = insertelement <16 x i32> <i32 212739, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>, i32 %tmp36, i32 1
42   %tmp38 = insertelement <16 x i32> %tmp37, i32 undef, i32 2
43   %tmp39 = insertelement <16 x i32> %tmp38, i32 undef, i32 3
44   %tmp40 = insertelement <16 x i32> %tmp39, i32 undef, i32 4
45   %tmp41 = insertelement <16 x i32> %tmp40, i32 0, i32 5
46   %tmp42 = insertelement <16 x i32> %tmp41, i32 undef, i32 6
47   %tmp43 = insertelement <16 x i32> %tmp42, i32 undef, i32 7
48   %tmp44 = insertelement <16 x i32> %tmp43, i32 undef, i32 8
49   %tmp45 = call <4 x float> @llvm.SI.image.sample.c.d.o.v16i32(<16 x i32> %tmp44, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0)
50   %tmp46 = extractelement <4 x float> %tmp45, i32 0
51   %tmp47 = fmul float %tmp35, %tmp46
52   %tmp48 = insertvalue <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> undef, float %tmp47, 14
53   %tmp49 = insertvalue <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> %tmp48, float %arg21, 24
54   ret <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> %tmp49
55 }
56
57 declare float @llvm.SI.fs.interp(i32, i32, i32, <2 x i32>) #1
58 declare float @llvm.SI.load.const(<16 x i8>, i32) #1
59 declare <4 x float> @llvm.SI.image.sample.c.d.o.v16i32(<16 x i32>, <8 x i32>, <4 x i32>, i32, i32, i32, i32, i32, i32, i32, i32) #1
60
61 attributes #0 = { "InitialPSInputAddr"="36983" "target-cpu"="tonga" }
62 attributes #1 = { nounwind readnone }