[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Lower / arithmetic-goto.f90
blob7686ac4cf9384e52bcff07df66e463f47db938a7
1 ! RUN: bbc -emit-fir -o - %s | FileCheck %s
3 ! CHECK-LABEL: func @_QPkagi
4 function kagi(index)
5 ! CHECK: fir.select_case %{{.}} : i32 [#fir.upper, %c-1_i32, ^bb{{.}}, #fir.lower, %c1_i32, ^bb{{.}}, unit, ^bb{{.}}]
6 if (index) 7, 8, 9
7 kagi = 0; return
8 7 kagi = 1; return
9 8 kagi = 2; return
10 9 kagi = 3; return
11 end
13 ! CHECK-LABEL: func @_QPkagf
14 function kagf(findex)
15 ! CHECK: %[[zero:.+]] = arith.constant 0.0
16 ! CHECK: %{{.+}} = arith.cmpf olt, %{{.+}}, %[[zero]] : f32
17 ! CHECK: cond_br %
18 ! CHECK: %{{.+}} = arith.cmpf ogt, %{{.+}}, %[[zero]] : f32
19 ! CHECK: cond_br %
20 ! CHECK: br ^
21 if (findex+findex) 7, 8, 9
22 kagf = 0; return
23 7 kagf = 1; return
24 8 kagf = 2; return
25 9 kagf = 3; return
26 end
28 ! CHECK-LABEL: func @_QQmain
29 do i = -2, 2
30 print*, kagi(i)
31 enddo
33 print*, kagf(-2.0)
34 print*, kagf(-1.0)
35 print*, kagf(-0.0)
36 print*, kagf( 0.0)
37 print*, kagf(+0.0)
38 print*, kagf(+1.0)
39 print*, kagf(+2.0)
40 end