blob: 7570eca4157bf35ec0f02f9fd8de7f5aa895bae5 [file] [log] [blame]
Matt Arsenault84db5d92015-07-14 17:57:36 +00001; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs -mattr=+load-store-opt < %s | FileCheck -strict-whitespace -check-prefix=SI %s
Matt Arsenault41033282014-10-10 22:01:59 +00002
Matt Arsenaultcc8d3b82014-11-13 19:56:13 +00003@lds = addrspace(3) global [512 x float] undef, align 4
4@lds.f64 = addrspace(3) global [512 x double] undef, align 8
Matt Arsenault41033282014-10-10 22:01:59 +00005
6
7; SI-LABEL: @simple_write2_one_val_f32
Tom Stellard326d6ec2014-11-05 14:50:53 +00008; SI-DAG: buffer_load_dword [[VAL:v[0-9]+]]
9; SI-DAG: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 2, v{{[0-9]+}}
Tom Stellard1f3416a2015-04-08 01:09:19 +000010; SI: ds_write2_b32 [[VPTR]], [[VAL]], [[VAL]] offset1:8
Tom Stellard326d6ec2014-11-05 14:50:53 +000011; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +000012define void @simple_write2_one_val_f32(float addrspace(1)* %C, float addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +000013 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +000014 %in.gep = getelementptr float, float addrspace(1)* %in, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +000015 %val = load float, float addrspace(1)* %in.gep, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000016 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +000017 store float %val, float addrspace(3)* %arrayidx0, align 4
18 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +000019 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +000020 store float %val, float addrspace(3)* %arrayidx1, align 4
21 ret void
22}
23
24; SI-LABEL: @simple_write2_two_val_f32
Tom Stellard326d6ec2014-11-05 14:50:53 +000025; SI-DAG: buffer_load_dword [[VAL0:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
Matt Arsenaultfb13b222014-12-03 03:12:13 +000026; SI-DAG: buffer_load_dword [[VAL1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
Tom Stellard326d6ec2014-11-05 14:50:53 +000027; SI-DAG: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 2, v{{[0-9]+}}
Matt Arsenault84db5d92015-07-14 17:57:36 +000028; SI: ds_write2_b32 [[VPTR]], [[VAL0]], [[VAL1]] offset1:8
Tom Stellard326d6ec2014-11-05 14:50:53 +000029; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +000030define void @simple_write2_two_val_f32(float addrspace(1)* %C, float addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +000031 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +000032 %in.gep.0 = getelementptr float, float addrspace(1)* %in, i32 %x.i
33 %in.gep.1 = getelementptr float, float addrspace(1)* %in.gep.0, i32 1
David Blaikiea79ac142015-02-27 21:17:42 +000034 %val0 = load float, float addrspace(1)* %in.gep.0, align 4
35 %val1 = load float, float addrspace(1)* %in.gep.1, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000036 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +000037 store float %val0, float addrspace(3)* %arrayidx0, align 4
38 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +000039 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +000040 store float %val1, float addrspace(3)* %arrayidx1, align 4
41 ret void
42}
43
44; SI-LABEL: @simple_write2_two_val_f32_volatile_0
Tom Stellard326d6ec2014-11-05 14:50:53 +000045; SI-NOT: ds_write2_b32
46; SI: ds_write_b32 {{v[0-9]+}}, {{v[0-9]+}}
47; SI: ds_write_b32 {{v[0-9]+}}, {{v[0-9]+}} offset:32
48; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +000049define void @simple_write2_two_val_f32_volatile_0(float addrspace(1)* %C, float addrspace(1)* %in0, float addrspace(1)* %in1) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +000050 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +000051 %in0.gep = getelementptr float, float addrspace(1)* %in0, i32 %x.i
52 %in1.gep = getelementptr float, float addrspace(1)* %in1, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +000053 %val0 = load float, float addrspace(1)* %in0.gep, align 4
54 %val1 = load float, float addrspace(1)* %in1.gep, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000055 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +000056 store volatile float %val0, float addrspace(3)* %arrayidx0, align 4
57 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +000058 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +000059 store float %val1, float addrspace(3)* %arrayidx1, align 4
60 ret void
61}
62
63; SI-LABEL: @simple_write2_two_val_f32_volatile_1
Tom Stellard326d6ec2014-11-05 14:50:53 +000064; SI-NOT: ds_write2_b32
65; SI: ds_write_b32 {{v[0-9]+}}, {{v[0-9]+}}
66; SI: ds_write_b32 {{v[0-9]+}}, {{v[0-9]+}} offset:32
67; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +000068define void @simple_write2_two_val_f32_volatile_1(float addrspace(1)* %C, float addrspace(1)* %in0, float addrspace(1)* %in1) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +000069 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +000070 %in0.gep = getelementptr float, float addrspace(1)* %in0, i32 %x.i
71 %in1.gep = getelementptr float, float addrspace(1)* %in1, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +000072 %val0 = load float, float addrspace(1)* %in0.gep, align 4
73 %val1 = load float, float addrspace(1)* %in1.gep, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000074 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +000075 store float %val0, float addrspace(3)* %arrayidx0, align 4
76 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +000077 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +000078 store volatile float %val1, float addrspace(3)* %arrayidx1, align 4
79 ret void
80}
81
82; 2 data subregisters from different super registers.
83; SI-LABEL: @simple_write2_two_val_subreg2_mixed_f32
Tom Stellard326d6ec2014-11-05 14:50:53 +000084; SI: buffer_load_dwordx2 v{{\[}}[[VAL0:[0-9]+]]:{{[0-9]+\]}}
85; SI: buffer_load_dwordx2 v{{\[[0-9]+}}:[[VAL1:[0-9]+]]{{\]}}
86; SI: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 2, v{{[0-9]+}}
Tom Stellard1f3416a2015-04-08 01:09:19 +000087; SI: ds_write2_b32 [[VPTR]], v[[VAL0]], v[[VAL1]] offset1:8
Tom Stellard326d6ec2014-11-05 14:50:53 +000088; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +000089define void @simple_write2_two_val_subreg2_mixed_f32(float addrspace(1)* %C, <2 x float> addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +000090 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +000091 %in.gep.0 = getelementptr <2 x float>, <2 x float> addrspace(1)* %in, i32 %x.i
92 %in.gep.1 = getelementptr <2 x float>, <2 x float> addrspace(1)* %in.gep.0, i32 1
David Blaikiea79ac142015-02-27 21:17:42 +000093 %val0 = load <2 x float>, <2 x float> addrspace(1)* %in.gep.0, align 8
94 %val1 = load <2 x float>, <2 x float> addrspace(1)* %in.gep.1, align 8
Matt Arsenault41033282014-10-10 22:01:59 +000095 %val0.0 = extractelement <2 x float> %val0, i32 0
96 %val1.1 = extractelement <2 x float> %val1, i32 1
David Blaikie79e6c742015-02-27 19:29:02 +000097 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +000098 store float %val0.0, float addrspace(3)* %arrayidx0, align 4
99 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +0000100 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +0000101 store float %val1.1, float addrspace(3)* %arrayidx1, align 4
102 ret void
103}
104
105; SI-LABEL: @simple_write2_two_val_subreg2_f32
Tom Stellard326d6ec2014-11-05 14:50:53 +0000106; SI-DAG: buffer_load_dwordx2 v{{\[}}[[VAL0:[0-9]+]]:[[VAL1:[0-9]+]]{{\]}}
107; SI-DAG: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 2, v{{[0-9]+}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000108; SI: ds_write2_b32 [[VPTR]], v[[VAL0]], v[[VAL1]] offset1:8
Tom Stellard326d6ec2014-11-05 14:50:53 +0000109; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000110define void @simple_write2_two_val_subreg2_f32(float addrspace(1)* %C, <2 x float> addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000111 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000112 %in.gep = getelementptr <2 x float>, <2 x float> addrspace(1)* %in, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000113 %val = load <2 x float>, <2 x float> addrspace(1)* %in.gep, align 8
Matt Arsenault41033282014-10-10 22:01:59 +0000114 %val0 = extractelement <2 x float> %val, i32 0
115 %val1 = extractelement <2 x float> %val, i32 1
David Blaikie79e6c742015-02-27 19:29:02 +0000116 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +0000117 store float %val0, float addrspace(3)* %arrayidx0, align 4
118 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +0000119 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +0000120 store float %val1, float addrspace(3)* %arrayidx1, align 4
121 ret void
122}
123
124; SI-LABEL: @simple_write2_two_val_subreg4_f32
Tom Stellard326d6ec2014-11-05 14:50:53 +0000125; SI-DAG: buffer_load_dwordx4 v{{\[}}[[VAL0:[0-9]+]]:[[VAL1:[0-9]+]]{{\]}}
126; SI-DAG: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 2, v{{[0-9]+}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000127; SI: ds_write2_b32 [[VPTR]], v[[VAL0]], v[[VAL1]] offset1:8
Tom Stellard326d6ec2014-11-05 14:50:53 +0000128; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000129define void @simple_write2_two_val_subreg4_f32(float addrspace(1)* %C, <4 x float> addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000130 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000131 %in.gep = getelementptr <4 x float>, <4 x float> addrspace(1)* %in, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000132 %val = load <4 x float>, <4 x float> addrspace(1)* %in.gep, align 16
Matt Arsenault41033282014-10-10 22:01:59 +0000133 %val0 = extractelement <4 x float> %val, i32 0
134 %val1 = extractelement <4 x float> %val, i32 3
David Blaikie79e6c742015-02-27 19:29:02 +0000135 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +0000136 store float %val0, float addrspace(3)* %arrayidx0, align 4
137 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +0000138 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +0000139 store float %val1, float addrspace(3)* %arrayidx1, align 4
140 ret void
141}
142
143; SI-LABEL: @simple_write2_two_val_max_offset_f32
Tom Stellard326d6ec2014-11-05 14:50:53 +0000144; SI-DAG: buffer_load_dword [[VAL0:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
Matt Arsenaultfb13b222014-12-03 03:12:13 +0000145; SI-DAG: buffer_load_dword [[VAL1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
Tom Stellard326d6ec2014-11-05 14:50:53 +0000146; SI-DAG: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 2, v{{[0-9]+}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000147; SI: ds_write2_b32 [[VPTR]], [[VAL0]], [[VAL1]] offset1:255
Tom Stellard326d6ec2014-11-05 14:50:53 +0000148; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000149define void @simple_write2_two_val_max_offset_f32(float addrspace(1)* %C, float addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000150 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000151 %in.gep.0 = getelementptr float, float addrspace(1)* %in, i32 %x.i
152 %in.gep.1 = getelementptr float, float addrspace(1)* %in.gep.0, i32 1
David Blaikiea79ac142015-02-27 21:17:42 +0000153 %val0 = load float, float addrspace(1)* %in.gep.0, align 4
154 %val1 = load float, float addrspace(1)* %in.gep.1, align 4
David Blaikie79e6c742015-02-27 19:29:02 +0000155 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +0000156 store float %val0, float addrspace(3)* %arrayidx0, align 4
157 %add.x = add nsw i32 %x.i, 255
David Blaikie79e6c742015-02-27 19:29:02 +0000158 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +0000159 store float %val1, float addrspace(3)* %arrayidx1, align 4
160 ret void
161}
162
163; SI-LABEL: @simple_write2_two_val_too_far_f32
Tom Stellard326d6ec2014-11-05 14:50:53 +0000164; SI: ds_write_b32 v{{[0-9]+}}, v{{[0-9]+}}
165; SI: ds_write_b32 v{{[0-9]+}}, v{{[0-9]+}} offset:1028
166; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000167define void @simple_write2_two_val_too_far_f32(float addrspace(1)* %C, float addrspace(1)* %in0, float addrspace(1)* %in1) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000168 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000169 %in0.gep = getelementptr float, float addrspace(1)* %in0, i32 %x.i
170 %in1.gep = getelementptr float, float addrspace(1)* %in1, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000171 %val0 = load float, float addrspace(1)* %in0.gep, align 4
172 %val1 = load float, float addrspace(1)* %in1.gep, align 4
David Blaikie79e6c742015-02-27 19:29:02 +0000173 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +0000174 store float %val0, float addrspace(3)* %arrayidx0, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000175 %add.x = add nsw i32 %x.i, 257
David Blaikie79e6c742015-02-27 19:29:02 +0000176 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +0000177 store float %val1, float addrspace(3)* %arrayidx1, align 4
178 ret void
179}
180
181; SI-LABEL: @simple_write2_two_val_f32_x2
Tom Stellard0bc954e2016-03-30 16:35:09 +0000182; SI: ds_write2_b32 [[BASEADDR:v[0-9]+]], [[VAL0:v[0-9]+]], [[VAL0]] offset1:11
183; SI: ds_write2_b32 [[BASEADDR:v[0-9]+]], [[VAL1:v[0-9]+]], [[VAL1]] offset0:8 offset1:27
Tom Stellard326d6ec2014-11-05 14:50:53 +0000184; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000185define void @simple_write2_two_val_f32_x2(float addrspace(1)* %C, float addrspace(1)* %in0, float addrspace(1)* %in1) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000186 %tid.x = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000187 %in0.gep = getelementptr float, float addrspace(1)* %in0, i32 %tid.x
188 %in1.gep = getelementptr float, float addrspace(1)* %in1, i32 %tid.x
David Blaikiea79ac142015-02-27 21:17:42 +0000189 %val0 = load float, float addrspace(1)* %in0.gep, align 4
190 %val1 = load float, float addrspace(1)* %in1.gep, align 4
Matt Arsenault41033282014-10-10 22:01:59 +0000191
192 %idx.0 = add nsw i32 %tid.x, 0
David Blaikie79e6c742015-02-27 19:29:02 +0000193 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %idx.0
Matt Arsenault41033282014-10-10 22:01:59 +0000194 store float %val0, float addrspace(3)* %arrayidx0, align 4
195
196 %idx.1 = add nsw i32 %tid.x, 8
David Blaikie79e6c742015-02-27 19:29:02 +0000197 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %idx.1
Matt Arsenault41033282014-10-10 22:01:59 +0000198 store float %val1, float addrspace(3)* %arrayidx1, align 4
199
200 %idx.2 = add nsw i32 %tid.x, 11
David Blaikie79e6c742015-02-27 19:29:02 +0000201 %arrayidx2 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %idx.2
Matt Arsenault41033282014-10-10 22:01:59 +0000202 store float %val0, float addrspace(3)* %arrayidx2, align 4
203
204 %idx.3 = add nsw i32 %tid.x, 27
David Blaikie79e6c742015-02-27 19:29:02 +0000205 %arrayidx3 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %idx.3
Matt Arsenault41033282014-10-10 22:01:59 +0000206 store float %val1, float addrspace(3)* %arrayidx3, align 4
207
208 ret void
209}
210
211; SI-LABEL: @simple_write2_two_val_f32_x2_nonzero_base
Tom Stellard0bc954e2016-03-30 16:35:09 +0000212; SI: ds_write2_b32 [[BASEADDR:v[0-9]+]], [[VAL0:v[0-9]+]], [[VAL0]] offset0:3 offset1:11
213; SI: ds_write2_b32 [[BASEADDR:v[0-9]+]], [[VAL1:v[0-9]+]], [[VAL1]] offset0:8 offset1:27
Tom Stellard326d6ec2014-11-05 14:50:53 +0000214; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000215define void @simple_write2_two_val_f32_x2_nonzero_base(float addrspace(1)* %C, float addrspace(1)* %in0, float addrspace(1)* %in1) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000216 %tid.x = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000217 %in0.gep = getelementptr float, float addrspace(1)* %in0, i32 %tid.x
218 %in1.gep = getelementptr float, float addrspace(1)* %in1, i32 %tid.x
David Blaikiea79ac142015-02-27 21:17:42 +0000219 %val0 = load float, float addrspace(1)* %in0.gep, align 4
220 %val1 = load float, float addrspace(1)* %in1.gep, align 4
Matt Arsenault41033282014-10-10 22:01:59 +0000221
222 %idx.0 = add nsw i32 %tid.x, 3
David Blaikie79e6c742015-02-27 19:29:02 +0000223 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %idx.0
Matt Arsenault41033282014-10-10 22:01:59 +0000224 store float %val0, float addrspace(3)* %arrayidx0, align 4
225
226 %idx.1 = add nsw i32 %tid.x, 8
David Blaikie79e6c742015-02-27 19:29:02 +0000227 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %idx.1
Matt Arsenault41033282014-10-10 22:01:59 +0000228 store float %val1, float addrspace(3)* %arrayidx1, align 4
229
230 %idx.2 = add nsw i32 %tid.x, 11
David Blaikie79e6c742015-02-27 19:29:02 +0000231 %arrayidx2 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %idx.2
Matt Arsenault41033282014-10-10 22:01:59 +0000232 store float %val0, float addrspace(3)* %arrayidx2, align 4
233
234 %idx.3 = add nsw i32 %tid.x, 27
David Blaikie79e6c742015-02-27 19:29:02 +0000235 %arrayidx3 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %idx.3
Matt Arsenault41033282014-10-10 22:01:59 +0000236 store float %val1, float addrspace(3)* %arrayidx3, align 4
237
238 ret void
239}
240
241; SI-LABEL: @write2_ptr_subreg_arg_two_val_f32
Tom Stellard326d6ec2014-11-05 14:50:53 +0000242; SI-NOT: ds_write2_b32
243; SI: ds_write_b32
244; SI: ds_write_b32
245; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000246define void @write2_ptr_subreg_arg_two_val_f32(float addrspace(1)* %C, float addrspace(1)* %in0, float addrspace(1)* %in1, <2 x float addrspace(3)*> %lds.ptr) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000247 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000248 %in0.gep = getelementptr float, float addrspace(1)* %in0, i32 %x.i
249 %in1.gep = getelementptr float, float addrspace(1)* %in1, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000250 %val0 = load float, float addrspace(1)* %in0.gep, align 4
251 %val1 = load float, float addrspace(1)* %in1.gep, align 4
Matt Arsenault41033282014-10-10 22:01:59 +0000252
253 %index.0 = insertelement <2 x i32> undef, i32 %x.i, i32 0
254 %index.1 = insertelement <2 x i32> %index.0, i32 8, i32 0
David Blaikie79e6c742015-02-27 19:29:02 +0000255 %gep = getelementptr inbounds float, <2 x float addrspace(3)*> %lds.ptr, <2 x i32> %index.1
Matt Arsenault41033282014-10-10 22:01:59 +0000256 %gep.0 = extractelement <2 x float addrspace(3)*> %gep, i32 0
257 %gep.1 = extractelement <2 x float addrspace(3)*> %gep, i32 1
258
259 ; Apply an additional offset after the vector that will be more obviously folded.
David Blaikie79e6c742015-02-27 19:29:02 +0000260 %gep.1.offset = getelementptr float, float addrspace(3)* %gep.1, i32 8
Matt Arsenault41033282014-10-10 22:01:59 +0000261 store float %val0, float addrspace(3)* %gep.0, align 4
262
263 %add.x = add nsw i32 %x.i, 8
264 store float %val1, float addrspace(3)* %gep.1.offset, align 4
265 ret void
266}
267
268; SI-LABEL: @simple_write2_one_val_f64
Tom Stellard326d6ec2014-11-05 14:50:53 +0000269; SI: buffer_load_dwordx2 [[VAL:v\[[0-9]+:[0-9]+\]]],
270; SI: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 3, v{{[0-9]+}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000271; SI: ds_write2_b64 [[VPTR]], [[VAL]], [[VAL]] offset1:8
Tom Stellard326d6ec2014-11-05 14:50:53 +0000272; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000273define void @simple_write2_one_val_f64(double addrspace(1)* %C, double addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000274 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000275 %in.gep = getelementptr double, double addrspace(1)* %in, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000276 %val = load double, double addrspace(1)* %in.gep, align 8
David Blaikie79e6c742015-02-27 19:29:02 +0000277 %arrayidx0 = getelementptr inbounds [512 x double], [512 x double] addrspace(3)* @lds.f64, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +0000278 store double %val, double addrspace(3)* %arrayidx0, align 8
279 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +0000280 %arrayidx1 = getelementptr inbounds [512 x double], [512 x double] addrspace(3)* @lds.f64, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +0000281 store double %val, double addrspace(3)* %arrayidx1, align 8
282 ret void
283}
284
285; SI-LABEL: @misaligned_simple_write2_one_val_f64
Tom Stellard326d6ec2014-11-05 14:50:53 +0000286; SI-DAG: buffer_load_dwordx2 v{{\[}}[[VAL0:[0-9]+]]:[[VAL1:[0-9]+]]{{\]}}
287; SI-DAG: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 3, v{{[0-9]+}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000288; SI: ds_write2_b32 [[VPTR]], v[[VAL0]], v[[VAL1]] offset1:1
Tom Stellardeb05c612015-02-26 17:08:43 +0000289; SI: ds_write2_b32 [[VPTR]], v[[VAL0]], v[[VAL1]] offset0:14 offset1:15
Tom Stellard326d6ec2014-11-05 14:50:53 +0000290; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000291define void @misaligned_simple_write2_one_val_f64(double addrspace(1)* %C, double addrspace(1)* %in, double addrspace(3)* %lds) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000292 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000293 %in.gep = getelementptr double, double addrspace(1)* %in, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000294 %val = load double, double addrspace(1)* %in.gep, align 8
David Blaikie79e6c742015-02-27 19:29:02 +0000295 %arrayidx0 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +0000296 store double %val, double addrspace(3)* %arrayidx0, align 4
297 %add.x = add nsw i32 %x.i, 7
David Blaikie79e6c742015-02-27 19:29:02 +0000298 %arrayidx1 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +0000299 store double %val, double addrspace(3)* %arrayidx1, align 4
300 ret void
301}
302
303; SI-LABEL: @simple_write2_two_val_f64
Tom Stellard326d6ec2014-11-05 14:50:53 +0000304; SI-DAG: buffer_load_dwordx2 [[VAL0:v\[[0-9]+:[0-9]+\]]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
Matt Arsenaultfb13b222014-12-03 03:12:13 +0000305; SI-DAG: buffer_load_dwordx2 [[VAL1:v\[[0-9]+:[0-9]+\]]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:8
Tom Stellard326d6ec2014-11-05 14:50:53 +0000306; SI-DAG: v_lshlrev_b32_e32 [[VPTR:v[0-9]+]], 3, v{{[0-9]+}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000307; SI: ds_write2_b64 [[VPTR]], [[VAL0]], [[VAL1]] offset1:8
Tom Stellard326d6ec2014-11-05 14:50:53 +0000308; SI: s_endpgm
Matt Arsenault41033282014-10-10 22:01:59 +0000309define void @simple_write2_two_val_f64(double addrspace(1)* %C, double addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000310 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000311 %in.gep.0 = getelementptr double, double addrspace(1)* %in, i32 %x.i
312 %in.gep.1 = getelementptr double, double addrspace(1)* %in.gep.0, i32 1
David Blaikiea79ac142015-02-27 21:17:42 +0000313 %val0 = load double, double addrspace(1)* %in.gep.0, align 8
314 %val1 = load double, double addrspace(1)* %in.gep.1, align 8
David Blaikie79e6c742015-02-27 19:29:02 +0000315 %arrayidx0 = getelementptr inbounds [512 x double], [512 x double] addrspace(3)* @lds.f64, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +0000316 store double %val0, double addrspace(3)* %arrayidx0, align 8
317 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +0000318 %arrayidx1 = getelementptr inbounds [512 x double], [512 x double] addrspace(3)* @lds.f64, i32 0, i32 %add.x
Matt Arsenault41033282014-10-10 22:01:59 +0000319 store double %val1, double addrspace(3)* %arrayidx1, align 8
320 ret void
321}
322
Matt Arsenaultcc8d3b82014-11-13 19:56:13 +0000323@foo = addrspace(3) global [4 x i32] undef, align 4
Matt Arsenaulte775f5f2014-10-14 17:21:19 +0000324
325; SI-LABEL: @store_constant_adjacent_offsets
Tom Stellard326d6ec2014-11-05 14:50:53 +0000326; SI: v_mov_b32_e32 [[ZERO:v[0-9]+]], 0{{$}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000327; SI: ds_write2_b32 [[ZERO]], v{{[0-9]+}}, v{{[0-9]+}} offset1:1
Matt Arsenaulte775f5f2014-10-14 17:21:19 +0000328define void @store_constant_adjacent_offsets() {
David Blaikief72d05b2015-03-13 18:20:45 +0000329 store i32 123, i32 addrspace(3)* getelementptr inbounds ([4 x i32], [4 x i32] addrspace(3)* @foo, i32 0, i32 0), align 4
330 store i32 123, i32 addrspace(3)* getelementptr inbounds ([4 x i32], [4 x i32] addrspace(3)* @foo, i32 0, i32 1), align 4
Matt Arsenaulte775f5f2014-10-14 17:21:19 +0000331 ret void
332}
333
334; SI-LABEL: @store_constant_disjoint_offsets
Tom Stellard326d6ec2014-11-05 14:50:53 +0000335; SI-DAG: v_mov_b32_e32 [[VAL:v[0-9]+]], 0x7b{{$}}
336; SI-DAG: v_mov_b32_e32 [[ZERO:v[0-9]+]], 0{{$}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000337; SI: ds_write2_b32 [[ZERO]], [[VAL]], [[VAL]] offset1:2
Matt Arsenaulte775f5f2014-10-14 17:21:19 +0000338define void @store_constant_disjoint_offsets() {
David Blaikief72d05b2015-03-13 18:20:45 +0000339 store i32 123, i32 addrspace(3)* getelementptr inbounds ([4 x i32], [4 x i32] addrspace(3)* @foo, i32 0, i32 0), align 4
340 store i32 123, i32 addrspace(3)* getelementptr inbounds ([4 x i32], [4 x i32] addrspace(3)* @foo, i32 0, i32 2), align 4
Matt Arsenaulte775f5f2014-10-14 17:21:19 +0000341 ret void
342}
343
Matt Arsenaultcc8d3b82014-11-13 19:56:13 +0000344@bar = addrspace(3) global [4 x i64] undef, align 4
Matt Arsenault1a74aff2014-10-15 18:06:43 +0000345
346; SI-LABEL: @store_misaligned64_constant_offsets
Tom Stellard326d6ec2014-11-05 14:50:53 +0000347; SI: v_mov_b32_e32 [[ZERO:v[0-9]+]], 0{{$}}
Matt Arsenault61001bb2015-11-25 19:58:34 +0000348; SI-DAG: ds_write2_b32 [[ZERO]], v{{[0-9]+}}, v{{[0-9]+}} offset1:1
349; SI-DAG: ds_write2_b32 [[ZERO]], v{{[0-9]+}}, v{{[0-9]+}} offset0:2 offset1:3
350; SI: s_endpgm
Matt Arsenault1a74aff2014-10-15 18:06:43 +0000351define void @store_misaligned64_constant_offsets() {
David Blaikief72d05b2015-03-13 18:20:45 +0000352 store i64 123, i64 addrspace(3)* getelementptr inbounds ([4 x i64], [4 x i64] addrspace(3)* @bar, i32 0, i32 0), align 4
353 store i64 123, i64 addrspace(3)* getelementptr inbounds ([4 x i64], [4 x i64] addrspace(3)* @bar, i32 0, i32 1), align 4
Matt Arsenault1a74aff2014-10-15 18:06:43 +0000354 ret void
355}
356
Matt Arsenaultcc8d3b82014-11-13 19:56:13 +0000357@bar.large = addrspace(3) global [4096 x i64] undef, align 4
Matt Arsenault1a74aff2014-10-15 18:06:43 +0000358
359; SI-LABEL: @store_misaligned64_constant_large_offsets
Tom Stellard326d6ec2014-11-05 14:50:53 +0000360; SI-DAG: v_mov_b32_e32 [[BASE0:v[0-9]+]], 0x7ff8{{$}}
361; SI-DAG: v_mov_b32_e32 [[BASE1:v[0-9]+]], 0x4000{{$}}
Tom Stellard1f3416a2015-04-08 01:09:19 +0000362; SI-DAG: ds_write2_b32 [[BASE0]], v{{[0-9]+}}, v{{[0-9]+}} offset1:1
363; SI-DAG: ds_write2_b32 [[BASE1]], v{{[0-9]+}}, v{{[0-9]+}} offset1:1
Tom Stellard326d6ec2014-11-05 14:50:53 +0000364; SI: s_endpgm
Matt Arsenault1a74aff2014-10-15 18:06:43 +0000365define void @store_misaligned64_constant_large_offsets() {
David Blaikief72d05b2015-03-13 18:20:45 +0000366 store i64 123, i64 addrspace(3)* getelementptr inbounds ([4096 x i64], [4096 x i64] addrspace(3)* @bar.large, i32 0, i32 2048), align 4
367 store i64 123, i64 addrspace(3)* getelementptr inbounds ([4096 x i64], [4096 x i64] addrspace(3)* @bar.large, i32 0, i32 4095), align 4
Matt Arsenault1a74aff2014-10-15 18:06:43 +0000368 ret void
369}
370
Matt Arsenaultcc8d3b82014-11-13 19:56:13 +0000371@sgemm.lA = internal unnamed_addr addrspace(3) global [264 x float] undef, align 4
372@sgemm.lB = internal unnamed_addr addrspace(3) global [776 x float] undef, align 4
Matt Arsenault41033282014-10-10 22:01:59 +0000373
374define void @write2_sgemm_sequence(float addrspace(1)* %C, i32 %lda, i32 %ldb, float addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000375 %x.i = tail call i32 @llvm.amdgcn.workgroup.id.x() #1
376 %y.i = tail call i32 @llvm.amdgcn.workitem.id.y() #1
David Blaikiea79ac142015-02-27 21:17:42 +0000377 %val = load float, float addrspace(1)* %in
David Blaikie79e6c742015-02-27 19:29:02 +0000378 %arrayidx44 = getelementptr inbounds [264 x float], [264 x float] addrspace(3)* @sgemm.lA, i32 0, i32 %x.i
Matt Arsenault41033282014-10-10 22:01:59 +0000379 store float %val, float addrspace(3)* %arrayidx44, align 4
380 %add47 = add nsw i32 %x.i, 1
David Blaikie79e6c742015-02-27 19:29:02 +0000381 %arrayidx48 = getelementptr inbounds [264 x float], [264 x float] addrspace(3)* @sgemm.lA, i32 0, i32 %add47
Matt Arsenault41033282014-10-10 22:01:59 +0000382 store float %val, float addrspace(3)* %arrayidx48, align 4
383 %add51 = add nsw i32 %x.i, 16
David Blaikie79e6c742015-02-27 19:29:02 +0000384 %arrayidx52 = getelementptr inbounds [264 x float], [264 x float] addrspace(3)* @sgemm.lA, i32 0, i32 %add51
Matt Arsenault41033282014-10-10 22:01:59 +0000385 store float %val, float addrspace(3)* %arrayidx52, align 4
386 %add55 = add nsw i32 %x.i, 17
David Blaikie79e6c742015-02-27 19:29:02 +0000387 %arrayidx56 = getelementptr inbounds [264 x float], [264 x float] addrspace(3)* @sgemm.lA, i32 0, i32 %add55
Matt Arsenault41033282014-10-10 22:01:59 +0000388 store float %val, float addrspace(3)* %arrayidx56, align 4
David Blaikie79e6c742015-02-27 19:29:02 +0000389 %arrayidx60 = getelementptr inbounds [776 x float], [776 x float] addrspace(3)* @sgemm.lB, i32 0, i32 %y.i
Matt Arsenault41033282014-10-10 22:01:59 +0000390 store float %val, float addrspace(3)* %arrayidx60, align 4
391 %add63 = add nsw i32 %y.i, 1
David Blaikie79e6c742015-02-27 19:29:02 +0000392 %arrayidx64 = getelementptr inbounds [776 x float], [776 x float] addrspace(3)* @sgemm.lB, i32 0, i32 %add63
Matt Arsenault41033282014-10-10 22:01:59 +0000393 store float %val, float addrspace(3)* %arrayidx64, align 4
394 %add67 = add nsw i32 %y.i, 32
David Blaikie79e6c742015-02-27 19:29:02 +0000395 %arrayidx68 = getelementptr inbounds [776 x float], [776 x float] addrspace(3)* @sgemm.lB, i32 0, i32 %add67
Matt Arsenault41033282014-10-10 22:01:59 +0000396 store float %val, float addrspace(3)* %arrayidx68, align 4
397 %add71 = add nsw i32 %y.i, 33
David Blaikie79e6c742015-02-27 19:29:02 +0000398 %arrayidx72 = getelementptr inbounds [776 x float], [776 x float] addrspace(3)* @sgemm.lB, i32 0, i32 %add71
Matt Arsenault41033282014-10-10 22:01:59 +0000399 store float %val, float addrspace(3)* %arrayidx72, align 4
400 %add75 = add nsw i32 %y.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +0000401 %arrayidx76 = getelementptr inbounds [776 x float], [776 x float] addrspace(3)* @sgemm.lB, i32 0, i32 %add75
Matt Arsenault41033282014-10-10 22:01:59 +0000402 store float %val, float addrspace(3)* %arrayidx76, align 4
403 %add79 = add nsw i32 %y.i, 65
David Blaikie79e6c742015-02-27 19:29:02 +0000404 %arrayidx80 = getelementptr inbounds [776 x float], [776 x float] addrspace(3)* @sgemm.lB, i32 0, i32 %add79
Matt Arsenault41033282014-10-10 22:01:59 +0000405 store float %val, float addrspace(3)* %arrayidx80, align 4
406 ret void
407}
408
Matt Arsenault84db5d92015-07-14 17:57:36 +0000409; CI-LABEL: {{^}}simple_write2_v4f32_superreg_align4:
410; CI: ds_write2_b32 {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}} offset0:3 offset1:2{{$}}
411; CI: ds_write2_b32 {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}} offset0:1{{$}}
412; CI: s_endpgm
413define void @simple_write2_v4f32_superreg_align4(<4 x float> addrspace(3)* %out, <4 x float> addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000414 %x.i = tail call i32 @llvm.amdgcn.workitem.id.x() #1
Matt Arsenault84db5d92015-07-14 17:57:36 +0000415 %in.gep = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %in
416 %val0 = load <4 x float>, <4 x float> addrspace(1)* %in.gep, align 4
417 %out.gep = getelementptr inbounds <4 x float>, <4 x float> addrspace(3)* %out, i32 %x.i
418 store <4 x float> %val0, <4 x float> addrspace(3)* %out.gep, align 4
419 ret void
420}
421
Matt Arsenault41033282014-10-10 22:01:59 +0000422; Function Attrs: nounwind readnone
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000423declare i32 @llvm.amdgcn.workgroup.id.x() #1
Matt Arsenault41033282014-10-10 22:01:59 +0000424
425; Function Attrs: nounwind readnone
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000426declare i32 @llvm.amdgcn.workgroup.id.y() #1
Matt Arsenault41033282014-10-10 22:01:59 +0000427
428; Function Attrs: nounwind readnone
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000429declare i32 @llvm.amdgcn.workitem.id.x() #1
Matt Arsenault41033282014-10-10 22:01:59 +0000430
431; Function Attrs: nounwind readnone
Matt Arsenault9c47dd52016-02-11 06:02:01 +0000432declare i32 @llvm.amdgcn.workitem.id.y() #1
Matt Arsenault41033282014-10-10 22:01:59 +0000433
434attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
435attributes #1 = { nounwind readnone }
Matt Arsenault2aed6ca2015-12-19 01:46:41 +0000436attributes #2 = { convergent nounwind }