@@ -22,16 +22,16 @@ func.func @test_call_composite(%arg0 : !fir.ref<!composite>) {
2222}
2323
2424!hfa_f16 = !fir.type<t2{x:f16, y:f16}>
25- // CHECK-LABEL: func.func private @test_hfa_f16() -> !fir.array<2xf16 >
25+ // CHECK-LABEL: func.func private @test_hfa_f16() -> !fir.type<t2{x:f16,y:f16} >
2626func.func private @test_hfa_f16() -> !hfa_f16
2727// CHECK-LABEL: func.func @test_call_hfa_f16(
2828// CHECK-SAME: %[[ARG0:.*]]: !fir.ref<!fir.type<t2{x:f16,y:f16}>>) {
2929func.func @test_call_hfa_f16(%arg0 : !fir.ref<!hfa_f16>) {
30- // CHECK: %[[OUT:.*]] = fir.call @test_hfa_f16() : () -> !fir.array<2xf16 >
30+ // CHECK: %[[OUT:.*]] = fir.call @test_hfa_f16() : () -> !fir.type<t2{x:f16,y:f16} >
3131 // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
32- // CHECK: %[[ARR:.*]] = fir.alloca !fir.array<2xf16 >
33- // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.array<2xf16 >>
34- // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.array<2xf16 >>) -> !fir.ref<!fir.type<t2{x:f16,y:f16}>>
32+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t2{x:f16,y:f16} >
33+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t2{x:f16,y:f16} >>
34+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t2{x:f16,y:f16} >>) -> !fir.ref<!fir.type<t2{x:f16,y:f16}>>
3535 // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t2{x:f16,y:f16}>>
3636 // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
3737 %out = fir.call @test_hfa_f16() : () -> !hfa_f16
@@ -41,16 +41,16 @@ func.func @test_call_hfa_f16(%arg0 : !fir.ref<!hfa_f16>) {
4141}
4242
4343!hfa_f32 = !fir.type<t3{w:f32, x:f32, y:f32, z:f32}>
44- // CHECK-LABEL: func.func private @test_hfa_f32() -> !fir.array<4xf32 >
44+ // CHECK-LABEL: func.func private @test_hfa_f32() -> !fir.type<t3{w:f32,x:f32,y:f32,z:f32} >
4545func.func private @test_hfa_f32() -> !hfa_f32
4646// CHECK-LABEL: func.func @test_call_hfa_f32(
4747// CHECK-SAME: %[[ARG0:.*]]: !fir.ref<!fir.type<t3{w:f32,x:f32,y:f32,z:f32}>>) {
4848func.func @test_call_hfa_f32(%arg0 : !fir.ref<!hfa_f32>) {
49- // CHECK: %[[OUT:.*]] = fir.call @test_hfa_f32() : () -> !fir.array<4xf32 >
49+ // CHECK: %[[OUT:.*]] = fir.call @test_hfa_f32() : () -> !fir.type<t3{w:f32,x:f32,y:f32,z:f32} >
5050 // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
51- // CHECK: %[[ARR:.*]] = fir.alloca !fir.array<4xf32 >
52- // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.array<4xf32 >>
53- // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.array<4xf32 >>) -> !fir.ref<!fir.type<t3{w:f32,x:f32,y:f32,z:f32}>>
51+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t3{w:f32,x:f32,y:f32,z:f32} >
52+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t3{w:f32,x:f32,y:f32,z:f32} >>
53+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t3{w:f32,x:f32,y:f32,z:f32} >>) -> !fir.ref<!fir.type<t3{w:f32,x:f32,y:f32,z:f32}>>
5454 // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t3{w:f32,x:f32,y:f32,z:f32}>>
5555 // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
5656 %out = fir.call @test_hfa_f32() : () -> !hfa_f32
@@ -60,16 +60,16 @@ func.func @test_call_hfa_f32(%arg0 : !fir.ref<!hfa_f32>) {
6060}
6161
6262!hfa_f64 = !fir.type<t4{x:f64, y:f64, z:f64}>
63- // CHECK-LABEL: func.func private @test_hfa_f64() -> !fir.array<3xf64 >
63+ // CHECK-LABEL: func.func private @test_hfa_f64() -> !fir.type<t4{x:f64,y:f64,z:f64} >
6464func.func private @test_hfa_f64() -> !hfa_f64
6565// CHECK-LABEL: func.func @test_call_hfa_f64(
6666// CHECK-SAME: %[[ARG0:.*]]: !fir.ref<!fir.type<t4{x:f64,y:f64,z:f64}>>)
6767func.func @test_call_hfa_f64(%arg0 : !fir.ref<!hfa_f64>) {
68- // CHECK: %[[OUT:.*]] = fir.call @test_hfa_f64() : () -> !fir.array<3xf64 >
68+ // CHECK: %[[OUT:.*]] = fir.call @test_hfa_f64() : () -> !fir.type<t4{x:f64,y:f64,z:f64} >
6969 // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
70- // CHECK: %[[ARR:.*]] = fir.alloca !fir.array<3xf64 >
71- // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.array<3xf64 >>
72- // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.array<3xf64 >>) -> !fir.ref<!fir.type<t4{x:f64,y:f64,z:f64}>>
70+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t4{x:f64,y:f64,z:f64} >
71+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t4{x:f64,y:f64,z:f64} >>
72+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t4{x:f64,y:f64,z:f64} >>) -> !fir.ref<!fir.type<t4{x:f64,y:f64,z:f64}>>
7373 // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t4{x:f64,y:f64,z:f64}>>
7474 // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
7575 %out = fir.call @test_hfa_f64() : () -> !hfa_f64
@@ -79,16 +79,16 @@ func.func @test_call_hfa_f64(%arg0 : !fir.ref<!hfa_f64>) {
7979}
8080
8181!hfa_f128 = !fir.type<t5{w:f128, x:f128, y:f128, z:f128}>
82- // CHECK-LABEL: func.func private @test_hfa_f128() -> !fir.array<4xf128 >
82+ // CHECK-LABEL: func.func private @test_hfa_f128() -> !fir.type<t5{w:f128,x:f128,y:f128,z:f128} >
8383func.func private @test_hfa_f128() -> !hfa_f128
8484// CHECK-LABEL: func.func @test_call_hfa_f128(
8585// CHECK-SAME: %[[ARG0:.*]]: !fir.ref<!fir.type<t5{w:f128,x:f128,y:f128,z:f128}>>) {
8686func.func @test_call_hfa_f128(%arg0 : !fir.ref<!hfa_f128>) {
87- // CHECK: %[[OUT:.*]] = fir.call @test_hfa_f128() : () -> !fir.array<4xf128 >
87+ // CHECK: %[[OUT:.*]] = fir.call @test_hfa_f128() : () -> !fir.type<t5{w:f128,x:f128,y:f128,z:f128} >
8888 // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
89- // CHECK: %[[ARR:.*]] = fir.alloca !fir.array<4xf128 >
90- // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.array<4xf128 >>
91- // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.array<4xf128 >>) -> !fir.ref<!fir.type<t5{w:f128,x:f128,y:f128,z:f128}>>
89+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t5{w:f128,x:f128,y:f128,z:f128} >
90+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t5{w:f128,x:f128,y:f128,z:f128} >>
91+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t5{w:f128,x:f128,y:f128,z:f128} >>) -> !fir.ref<!fir.type<t5{w:f128,x:f128,y:f128,z:f128}>>
9292 // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t5{w:f128,x:f128,y:f128,z:f128}>>
9393 // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
9494 %out = fir.call @test_hfa_f128() : () -> !hfa_f128
@@ -98,16 +98,16 @@ func.func @test_call_hfa_f128(%arg0 : !fir.ref<!hfa_f128>) {
9898}
9999
100100!hfa_bf16 = !fir.type<t6{w:bf16, x:bf16, y:bf16, z:bf16}>
101- // CHECK-LABEL: func.func private @test_hfa_bf16() -> !fir.array<4xbf16 >
101+ // CHECK-LABEL: func.func private @test_hfa_bf16() -> !fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16} >
102102func.func private @test_hfa_bf16() -> !hfa_bf16
103103// CHECK-LABEL: func.func @test_call_hfa_bf16(
104104// CHECK-SAME: %[[ARG0:.*]]: !fir.ref<!fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16}>>) {
105105func.func @test_call_hfa_bf16(%arg0 : !fir.ref<!hfa_bf16>) {
106- // CHECK: %[[OUT:.*]] = fir.call @test_hfa_bf16() : () -> !fir.array<4xbf16 >
106+ // CHECK: %[[OUT:.*]] = fir.call @test_hfa_bf16() : () -> !fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16} >
107107 // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
108- // CHECK: %[[ARR:.*]] = fir.alloca !fir.array<4xbf16 >
109- // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.array<4xbf16 >>
110- // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.array<4xbf16 >>) -> !fir.ref<!fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16}>>
108+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16} >
109+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16} >>
110+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16} >>) -> !fir.ref<!fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16}>>
111111 // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t6{w:bf16,x:bf16,y:bf16,z:bf16}>>
112112 // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
113113 %out = fir.call @test_hfa_bf16() : () -> !hfa_bf16
@@ -154,3 +154,76 @@ func.func @test_call_too_big_hfa(%arg0 : !fir.ref<!too_big_hfa>) {
154154 fir.store %out to %arg0 : !fir.ref<!too_big_hfa>
155155 return
156156}
157+
158+ !nested_hfa_first = !fir.type<t9{s:!hfa_f16,c:f16}>
159+ // CHECK-LABEL: func.func private @test_nested_hfa_first() -> !fir.type<t9{s:!fir.type<t2{x:f16,y:f16}>,c:f16}>
160+ func.func private @test_nested_hfa_first() -> !nested_hfa_first
161+ // CHECK-LABEL: func.func @test_call_nested_hfa_first(%arg0: !fir.ref<!fir.type<t9{s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>) {
162+ func.func @test_call_nested_hfa_first(%arg0 : !fir.ref<!nested_hfa_first>) {
163+ %out = fir.call @test_nested_hfa_first() : () -> !nested_hfa_first
164+ // CHECK: %[[OUT:.*]] = fir.call @test_nested_hfa_first() : () -> !fir.type<t9{s:!fir.type<t2{x:f16,y:f16}>,c:f16}>
165+ // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
166+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t9{s:!fir.type<t2{x:f16,y:f16}>,c:f16}>
167+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t9{s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>
168+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t9{s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>
169+ // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t9{s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>
170+ // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
171+ fir.store %out to %arg0 : !fir.ref<!nested_hfa_first>
172+ // CHECK fir.store %[[LD]] to %[[ARG0]] : !fir.ref<!fir.type<t9{s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>
173+ return
174+ }
175+
176+
177+ !nested_hfa_middle = !fir.type<t10{a:f16,s:!hfa_f16,c:f16}>
178+ // CHECK-LABEL: func.func private @test_nested_hfa_middle() -> !fir.type<t10{a:f16,s:!fir.type<t2{x:f16,y:f16}>,c:f16}>
179+ func.func private @test_nested_hfa_middle() -> !nested_hfa_middle
180+ // CHECK-LABEL: func.func @test_call_nested_hfa_middle(%arg0: !fir.ref<!fir.type<t10{a:f16,s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>) {
181+ func.func @test_call_nested_hfa_middle(%arg0 : !fir.ref<!nested_hfa_middle>) {
182+ %out = fir.call @test_nested_hfa_middle() : () -> !nested_hfa_middle
183+ // CHECK: %[[OUT:.*]] = fir.call @test_nested_hfa_middle() : () -> !fir.type<t10{a:f16,s:!fir.type<t2{x:f16,y:f16}>,c:f16}>
184+ // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
185+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t10{a:f16,s:!fir.type<t2{x:f16,y:f16}>,c:f16}>
186+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t10{a:f16,s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>
187+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t10{a:f16,s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>
188+ // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t10{a:f16,s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>
189+ // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
190+ fir.store %out to %arg0 : !fir.ref<!nested_hfa_middle>
191+ // CHECK fir.store %[[LD]] to %[[ARG0]] : !fir.ref<!fir.type<t10{a:f16,s:!fir.type<t2{x:f16,y:f16}>,c:f16}>>
192+ return
193+ }
194+
195+ !nested_hfa_end = !fir.type<t11{a:f16,s:!hfa_f16}>
196+ // CHECK-LABEL: func.func private @test_nested_hfa_end() -> !fir.type<t11{a:f16,s:!fir.type<t2{x:f16,y:f16}>}>
197+ func.func private @test_nested_hfa_end() -> !nested_hfa_end
198+ // CHECK-LABEL: func.func @test_call_nested_hfa_end(%arg0: !fir.ref<!fir.type<t11{a:f16,s:!fir.type<t2{x:f16,y:f16}>}>>) {
199+ func.func @test_call_nested_hfa_end(%arg0 : !fir.ref<!nested_hfa_end>) {
200+ %out = fir.call @test_nested_hfa_end() : () -> !nested_hfa_end
201+ // CHECK: %[[OUT:.*]] = fir.call @test_nested_hfa_end() : () -> !fir.type<t11{a:f16,s:!fir.type<t2{x:f16,y:f16}>}>
202+ // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
203+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t11{a:f16,s:!fir.type<t2{x:f16,y:f16}>}>
204+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t11{a:f16,s:!fir.type<t2{x:f16,y:f16}>}>>
205+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t11{a:f16,s:!fir.type<t2{x:f16,y:f16}>}>>
206+ // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t11{a:f16,s:!fir.type<t2{x:f16,y:f16}>}>>
207+ // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
208+ fir.store %out to %arg0 : !fir.ref<!nested_hfa_end>
209+ // CHECK fir.store %[[LD]] to %[[ARG0]] : !fir.ref<!fir.type<t11{a:f16,s:!fir.type<t2{x:f16,y:f16}>}>>
210+ return
211+ }
212+
213+ !nested_hfa_array = !fir.type<t12{a:!fir.array<2xf32>,b:f32}>
214+ // CHECK-LABEL: func.func private @test_nested_hfa_array() -> !fir.type<t12{a:!fir.array<2xf32>,b:f32}>
215+ func.func private @test_nested_hfa_array() -> !nested_hfa_array
216+ // CHECK-LABEL: func.func @test_call_nested_hfa_array(%arg0: !fir.ref<!fir.type<t12{a:!fir.array<2xf32>,b:f32}>
217+ func.func @test_call_nested_hfa_array(%arg0 : !fir.ref<!nested_hfa_array>) {
218+ %out = fir.call @test_nested_hfa_array() : () -> !nested_hfa_array
219+ // CHECK: %[[OUT:.*]] = fir.call @test_nested_hfa_array() : () -> !fir.type<t12{a:!fir.array<2xf32>,b:f32}>
220+ // CHECK: %[[STACK:.*]] = llvm.intr.stacksave : !llvm.ptr
221+ // CHECK: %[[ARR:.*]] = fir.alloca !fir.type<t12{a:!fir.array<2xf32>,b:f32}>
222+ // CHECK: fir.store %[[OUT]] to %[[ARR]] : !fir.ref<!fir.type<t12{a:!fir.array<2xf32>,b:f32}>
223+ // CHECK: %[[CVT:.*]] = fir.convert %[[ARR]] : (!fir.ref<!fir.type<t12{a:!fir.array<2xf32>,b:f32}>
224+ // CHECK: %[[LD:.*]] = fir.load %[[CVT]] : !fir.ref<!fir.type<t12{a:!fir.array<2xf32>,b:f32}>
225+ // CHECK: llvm.intr.stackrestore %[[STACK]] : !llvm.ptr
226+ fir.store %out to %arg0 : !fir.ref<!nested_hfa_array>
227+ // CHECK fir.store %[[LD]] to %[[ARG0]] : !fir.ref<!fir.type<t12{a:!fir.array<2xf32>,b:f32}>
228+ return
229+ }
0 commit comments