brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 1f05384 Raw
70 lines · plain
1! This directory can be used to add Integration tests involving multiple stages of the compiler (for eg. from Fortran to LLVM IR).2! It should not contain executable tests. We should only add tests here sparingly and only if there is no other way to test.3! RUN: %flang_fc1 -emit-llvm -o - %s | FileCheck %s4 5! CHECK-LABEL: test_inline6subroutine test_inline()7  integer :: x, y8!CHECK:  %[[VAL_1:.*]] = alloca i32, i64 1, align 49!CHECK:  %[[VAL_2:.*]] = alloca i32, i64 1, align 410!CHECK:  %[[VAL_3:.*]] = alloca i32, i64 1, align 411!CHECK:  %[[VAL_4:.*]] = alloca i32, i64 1, align 412 13  !dir$ forceinline14  y = g(x)15  !dir$ forceinline16  call f(x, y)17!CHECK:  %[[VAL_5:.*]] = load i32, ptr %[[VAL_3]], align 418!CHECK:  %[[VAL_6:.*]] = mul i32 %[[VAL_5]], 219!CHECK:  store i32 %6, ptr %[[VAL_1]], align 420!CHECK:  %[[VAL_7:.*]] = load i32, ptr %[[VAL_1]], align 421!CHECK:  store i32 %7, ptr %[[VAL_2]], align 422!CHECK:  %[[VAL_8:.]] = load i32, ptr %[[VAL_3]], align 423!CHECK:  %[[VAL_9:.]] = mul i32 %[[VAL_8]], 224!CHECK:  store i32 %9, ptr %[[VAL_2]], align 425 26  !dir$ inline27  y = g(x)28  !dir$ inline29  call f(x, y)30!CHECK:  %[[VAL_10:.*]] = call i32 @_QFtest_inlinePg(ptr %[[VAL_3]]) #[[INLINE:.*]]31!CHECK:  store i32 %[[VAL_10]], ptr %[[VAL_2]], align 432!CHECK:  call void @_QFtest_inlinePf(ptr %[[VAL_3]], ptr %[[VAL_2]]) #[[INLINE]]33 34  !dir$ inline35  do i = 1, 10036    call f(x, y)37    !CHECK: br i1 %[[VAL_14:.*]], label %[[VAL_15:.*]], label %[[VAL_19:.*]]38    !CHECK: call void @_QFtest_inlinePf(ptr %[[VAL_3]], ptr %[[VAL_2]]) #[[INLINE]]39  enddo40 41  !dir$ noinline42  y = g(x)43  !dir$ noinline44  call f(x, y)45!CHECK:  %[[VAL_10:.*]] = call i32 @_QFtest_inlinePg(ptr %[[VAL_3]]) #[[NOINLINE:.*]]46!CHECK:  store i32 %[[VAL_10]], ptr %[[VAL_2]], align 447!CHECK:  call void @_QFtest_inlinePf(ptr %[[VAL_3]], ptr %[[VAL_2]]) #[[NOINLINE]]48 49  !dir$ noinline50  do i = 1, 10051    call f(x, y)52    !CHECK: br i1 %[[VAL_14:.*]], label %[[VAL_15:.*]], label %[[VAL_19:.*]]53    !CHECK: call void @_QFtest_inlinePf(ptr %[[VAL_3]], ptr %[[VAL_2]]) #[[NOINLINE]]54  enddo55 56  contains57    subroutine f(x, y)58      integer, intent(in) :: x59      integer, intent(out) :: y60      y = x*261    end subroutine f62    integer function g(x)63      integer :: x64      g = x*265    end function g66end subroutine test_inline67 68!CHECK: attributes #[[INLINE]] = { inlinehint }69!CHECK: attributes #[[NOINLINE]] = { noinline }70