[SelectOpt] Support ADD and SUB with zext operands. (#115489)
[llvm-project.git] / flang / test / Lower / branching-directive.f90
blob69270d7bcbe96cabb67b7c781d400aeb333a530f
1 !RUN: bbc -emit-hlfir -fopenacc -fopenmp -o - %s | FileCheck %s
3 !https://github.com/llvm/llvm-project/issues/91526
5 !CHECK-LABEL: func.func @_QPsimple1
6 !CHECK: cf.cond_br %{{[0-9]+}}, ^bb[[THEN:[0-9]+]], ^bb[[ELSE:[0-9]+]]
7 !CHECK: ^bb[[THEN]]:
8 !CHECK: omp.parallel
9 !CHECK: cf.br ^bb[[ENDIF:[0-9]+]]
10 !CHECK: ^bb[[ELSE]]:
11 !CHECK: fir.call @_FortranAStopStatement
12 !CHECK: fir.unreachable
13 !CHECK: ^bb[[ENDIF]]:
14 !CHECK: return
16 subroutine simple1(y)
17 implicit none
18 logical, intent(in) :: y
19 integer :: i
20 if (y) then
21 !$omp parallel
22 i = 1
23 !$omp end parallel
24 else
25 stop 1
26 end if
27 end subroutine
29 !CHECK-LABEL: func.func @_QPsimple2
30 !CHECK: cf.cond_br %{{[0-9]+}}, ^bb[[THEN:[0-9]+]], ^bb[[ELSE:[0-9]+]]
31 !CHECK: ^bb[[THEN]]:
32 !CHECK: omp.parallel
33 !CHECK: cf.br ^bb[[ENDIF:[0-9]+]]
34 !CHECK: ^bb[[ELSE]]:
35 !CHECK: fir.call @_FortranAStopStatement
36 !CHECK: fir.unreachable
37 !CHECK: ^bb[[ENDIF]]:
38 !CHECK: fir.call @_FortranAioOutputReal64
39 !CHECK: return
40 subroutine simple2(x, yn)
41 implicit none
42 logical, intent(in) :: yn
43 integer, intent(in) :: x
44 integer :: i
45 real(8) :: E
46 E = 0d0
48 if (yn) then
49 !$omp parallel do private(i) reduction(+:E)
50 do i = 1, x
51 E = E + i
52 end do
53 !$omp end parallel do
54 else
55 stop 1
56 end if
57 print *, E
58 end subroutine
60 !CHECK-LABEL: func.func @_QPacccase
61 !CHECK: fir.select_case %{{[0-9]+}} : i32 [{{.*}}, ^bb[[CASE1:[0-9]+]], {{.*}}, ^bb[[CASE2:[0-9]+]], {{.*}}, ^bb[[CASE3:[0-9]+]]]
62 !CHECK: ^bb[[CASE1]]:
63 !CHECK: acc.serial
64 !CHECK: cf.br ^bb[[EXIT:[0-9]+]]
65 !CHECK: ^bb[[CASE2]]:
66 !CHECK: fir.call @_FortranAioOutputAscii
67 !CHECK: cf.br ^bb[[EXIT]]
68 !CHECK: ^bb[[CASE3]]:
69 !CHECK: fir.call @_FortranAioOutputAscii
70 !CHECK: cf.br ^bb[[EXIT]]
71 !CHECK: ^bb[[EXIT]]:
72 !CHECK: return
73 subroutine acccase(var)
74 integer :: var
75 integer :: res(10)
76 select case (var)
77 case (1)
78 print *, "case 1"
79 !$acc serial
80 res(1) = 1
81 !$acc end serial
82 case (2)
83 print *, "case 2"
84 case default
85 print *, "case default"
86 end select
87 end subroutine