brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.3 KiB · 891f2fc Raw
157 lines · plain
1! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s2! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s3 4! CHECK-LABEL: dshiftr1_test5! CHECK-SAME: %[[A:.*]]: !fir.ref<i8>{{.*}}, %[[B:.*]]: !fir.ref<i8>{{.*}}, %[[S:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i8>{{.*}}6subroutine dshiftr1_test(a, b, s, c)7  integer(kind=1) :: a, b8  integer :: s9  integer(kind=1) :: c10 11  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i8>12  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i8>13  ! CHECK: %[[S_VAL:.*]] = fir.load %[[S]] : !fir.ref<i32>14  c = dshiftr(a, b, s)15  ! CHECK: %[[S_CONV:.*]] = fir.convert %[[S_VAL]] : (i32) -> i816  ! CHECK: %[[C_BITS:.*]] = arith.constant 8 : i817  ! CHECK: %[[DIFF:.*]] = arith.subi %[[C_BITS]], %[[S_CONV]] : i818  ! CHECK: %[[C_BITS_L:.*]] = arith.constant 8 : i819  ! CHECK: %[[C_0_L:.*]] = arith.constant 0 : i820  ! CHECK: %[[UNDER_L:.*]] = arith.cmpi slt, %[[DIFF]], %[[C_0_L]] : i821  ! CHECK: %[[OVER_L:.*]] = arith.cmpi sge, %[[DIFF]], %[[C_BITS_L]] : i822  ! CHECK: %[[INV_L:.*]] = arith.ori %[[UNDER_L]], %[[OVER_L]] : i123  ! CHECK: %[[SHL:.*]] = arith.shli %[[A_VAL]], %[[DIFF]] : i824  ! CHECK: %[[LFT:.*]] = arith.select %[[INV_L]], %[[C_0_L]], %[[SHL]] : i825  ! CHECK: %[[C_BITS_R:.*]] = arith.constant 8 : i826  ! CHECK: %[[C_0_R:.*]] = arith.constant 0 : i827  ! CHECK: %[[UNDER_R:.*]] = arith.cmpi slt, %[[S_CONV]], %[[C_0_R]] : i828  ! CHECK: %[[OVER_R:.*]] = arith.cmpi sge, %[[S_CONV]], %[[C_BITS_R]] : i829  ! CHECK: %[[INV_R:.*]] = arith.ori %[[UNDER_R]], %[[OVER_R]] : i130  ! CHECK: %[[SHR:.*]] = arith.shrui %[[B_VAL]], %[[S_CONV]] : i831  ! CHECK: %[[RGT:.*]] = arith.select %[[INV_R]], %[[C_0_R]], %[[SHR]] : i832  ! CHECK: %[[SHIFT:.*]] = arith.ori %[[LFT]], %[[RGT]] : i833end subroutine dshiftr1_test34 35! CHECK-LABEL: dshiftr2_test36! CHECK-SAME: %[[A:.*]]: !fir.ref<i16>{{.*}}, %[[B:.*]]: !fir.ref<i16>{{.*}}, %[[S:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i16>{{.*}}37subroutine dshiftr2_test(a, b, s, c)38  integer(kind=2) :: a, b39  integer :: s40  integer(kind=2) :: c41 42  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i16>43  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i16>44  ! CHECK: %[[S_VAL:.*]] = fir.load %[[S]] : !fir.ref<i32>45  c = dshiftr(a, b, s)46  ! CHECK: %[[S_CONV:.*]] = fir.convert %[[S_VAL]] : (i32) -> i1647  ! CHECK: %[[C_BITS:.*]] = arith.constant 16 : i1648  ! CHECK: %[[DIFF:.*]] = arith.subi %[[C_BITS]], %[[S_CONV]] : i1649  ! CHECK: %[[C_BITS_L:.*]] = arith.constant 16 : i1650  ! CHECK: %[[C_0_L:.*]] = arith.constant 0 : i1651  ! CHECK: %[[UNDER_L:.*]] = arith.cmpi slt, %[[DIFF]], %[[C_0_L]] : i1652  ! CHECK: %[[OVER_L:.*]] = arith.cmpi sge, %[[DIFF]], %[[C_BITS_L]] : i1653  ! CHECK: %[[INV_L:.*]] = arith.ori %[[UNDER_L]], %[[OVER_L]] : i154  ! CHECK: %[[SHL:.*]] = arith.shli %[[A_VAL]], %[[DIFF]] : i1655  ! CHECK: %[[LFT:.*]] = arith.select %[[INV_L]], %[[C_0_L]], %[[SHL]] : i1656  ! CHECK: %[[C_BITS_R:.*]] = arith.constant 16 : i1657  ! CHECK: %[[C_0_R:.*]] = arith.constant 0 : i1658  ! CHECK: %[[UNDER_R:.*]] = arith.cmpi slt, %[[S_CONV]], %[[C_0_R]] : i1659  ! CHECK: %[[OVER_R:.*]] = arith.cmpi sge, %[[S_CONV]], %[[C_BITS_R]] : i1660  ! CHECK: %[[INV_R:.*]] = arith.ori %[[UNDER_R]], %[[OVER_R]] : i161  ! CHECK: %[[SHR:.*]] = arith.shrui %[[B_VAL]], %[[S_CONV]] : i1662  ! CHECK: %[[RGT:.*]] = arith.select %[[INV_R]], %[[C_0_R]], %[[SHR]] : i1663  ! CHECK: %[[SHIFT:.*]] = arith.ori %[[LFT]], %[[RGT]] : i1664end subroutine dshiftr2_test65 66! CHECK-LABEL: dshiftr4_test67! CHECK-SAME: %[[A:.*]]: !fir.ref<i32>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[S:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i32>{{.*}}68subroutine dshiftr4_test(a, b, s, c)69  integer(kind=4) :: a, b70  integer :: s71  integer(kind=4) :: c72 73  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i32>74  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>75  ! CHECK: %[[S_VAL:.*]] = fir.load %[[S]] : !fir.ref<i32>76  c = dshiftr(a, b, s)77  ! CHECK: %[[C_BITS:.*]] = arith.constant 32 : i3278  ! CHECK: %[[DIFF:.*]] = arith.subi %[[C_BITS]], %[[S_VAL]] : i3279  ! CHECK: %[[C_BITS_L:.*]] = arith.constant 32 : i3280  ! CHECK: %[[C_0_L:.*]] = arith.constant 0 : i3281  ! CHECK: %[[UNDER_L:.*]] = arith.cmpi slt, %[[DIFF]], %[[C_0_L]] : i3282  ! CHECK: %[[OVER_L:.*]] = arith.cmpi sge, %[[DIFF]], %[[C_BITS_L]] : i3283  ! CHECK: %[[INV_L:.*]] = arith.ori %[[UNDER_L]], %[[OVER_L]] : i184  ! CHECK: %[[SHL:.*]] = arith.shli %[[A_VAL]], %[[DIFF]] : i3285  ! CHECK: %[[LFT:.*]] = arith.select %[[INV_L]], %[[C_0_L]], %[[SHL]] : i3286  ! CHECK: %[[C_BITS_R:.*]] = arith.constant 32 : i3287  ! CHECK: %[[C_0_R:.*]] = arith.constant 0 : i3288  ! CHECK: %[[UNDER_R:.*]] = arith.cmpi slt, %[[S_VAL]], %[[C_0_R]] : i3289  ! CHECK: %[[OVER_R:.*]] = arith.cmpi sge, %[[S_VAL]], %[[C_BITS_R]] : i3290  ! CHECK: %[[INV_R:.*]] = arith.ori %[[UNDER_R]], %[[OVER_R]] : i191  ! CHECK: %[[SHR:.*]] = arith.shrui %[[B_VAL]], %[[S_VAL]] : i3292  ! CHECK: %[[RGT:.*]] = arith.select %[[INV_R]], %[[C_0_R]], %[[SHR]] : i3293  ! CHECK: %[[SHIFT:.*]] = arith.ori %[[LFT]], %[[RGT]] : i3294end subroutine dshiftr4_test95 96! CHECK-LABEL: dshiftr8_test97! CHECK-SAME: %[[A:.*]]: !fir.ref<i64>{{.*}}, %[[B:.*]]: !fir.ref<i64>{{.*}}, %[[S:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i64>{{.*}}98subroutine dshiftr8_test(a, b, s, c)99  integer(kind=8) :: a, b100  integer :: s101  integer(kind=8) :: c102 103  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i64>104  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i64>105  ! CHECK: %[[S_VAL:.*]] = fir.load %[[S]] : !fir.ref<i32>106  c = dshiftr(a, b, s)107  ! CHECK: %[[S_CONV:.*]] = fir.convert %[[S_VAL]] : (i32) -> i64108  ! CHECK: %[[C_BITS:.*]] = arith.constant 64 : i64109  ! CHECK: %[[DIFF:.*]] = arith.subi %[[C_BITS]], %[[S_CONV]] : i64110  ! CHECK: %[[C_BITS_L:.*]] = arith.constant 64 : i64111  ! CHECK: %[[C_0_L:.*]] = arith.constant 0 : i64112  ! CHECK: %[[UNDER_L:.*]] = arith.cmpi slt, %[[DIFF]], %[[C_0_L]] : i64113  ! CHECK: %[[OVER_L:.*]] = arith.cmpi sge, %[[DIFF]], %[[C_BITS_L]] : i64114  ! CHECK: %[[INV_L:.*]] = arith.ori %[[UNDER_L]], %[[OVER_L]] : i1115  ! CHECK: %[[SHL:.*]] = arith.shli %[[A_VAL]], %[[DIFF]] : i64116  ! CHECK: %[[LFT:.*]] = arith.select %[[INV_L]], %[[C_0_L]], %[[SHL]] : i64117  ! CHECK: %[[C_BITS_R:.*]] = arith.constant 64 : i64118  ! CHECK: %[[C_0_R:.*]] = arith.constant 0 : i64119  ! CHECK: %[[UNDER_R:.*]] = arith.cmpi slt, %[[S_CONV]], %[[C_0_R]] : i64120  ! CHECK: %[[OVER_R:.*]] = arith.cmpi sge, %[[S_CONV]], %[[C_BITS_R]] : i64121  ! CHECK: %[[INV_R:.*]] = arith.ori %[[UNDER_R]], %[[OVER_R]] : i1122  ! CHECK: %[[SHR:.*]] = arith.shrui %[[B_VAL]], %[[S_CONV]] : i64123  ! CHECK: %[[RGT:.*]] = arith.select %[[INV_R]], %[[C_0_R]], %[[SHR]] : i64124  ! CHECK: %[[SHIFT:.*]] = arith.ori %[[LFT]], %[[RGT]] : i64125end subroutine dshiftr8_test126 127! CHECK-LABEL: dshiftr16_test128! CHECK-SAME: %[[A:.*]]: !fir.ref<i128>{{.*}}, %[[B:.*]]: !fir.ref<i128>{{.*}}, %[[S:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i128>{{.*}}129subroutine dshiftr16_test(a, b, s, c)130  integer(kind=16) :: a, b131  integer :: s132  integer(kind=16) :: c133 134  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i128>135  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i128>136  ! CHECK: %[[S_VAL:.*]] = fir.load %[[S]] : !fir.ref<i32>137  c = dshiftr(a, b, s)138  ! CHECK: %[[S_CONV:.*]] = fir.convert %[[S_VAL]] : (i32) -> i128139  ! CHECK: %[[C_BITS:.*]] = arith.constant 128 : i128140  ! CHECK: %[[DIFF:.*]] = arith.subi %[[C_BITS]], %[[S_CONV]] : i128141  ! CHECK: %[[C_BITS_L:.*]] = arith.constant 128 : i128142  ! CHECK: %[[C_0_L:.*]] = arith.constant 0 : i128143  ! CHECK: %[[UNDER_L:.*]] = arith.cmpi slt, %[[DIFF]], %[[C_0_L]] : i128144  ! CHECK: %[[OVER_L:.*]] = arith.cmpi sge, %[[DIFF]], %[[C_BITS_L]] : i128145  ! CHECK: %[[INV_L:.*]] = arith.ori %[[UNDER_L]], %[[OVER_L]] : i1146  ! CHECK: %[[SHL:.*]] = arith.shli %[[A_VAL]], %[[DIFF]] : i128147  ! CHECK: %[[LFT:.*]] = arith.select %[[INV_L]], %[[C_0_L]], %[[SHL]] : i128148  ! CHECK: %[[C_BITS_R:.*]] = arith.constant 128 : i128149  ! CHECK: %[[C_0_R:.*]] = arith.constant 0 : i128150  ! CHECK: %[[UNDER_R:.*]] = arith.cmpi slt, %[[S_CONV]], %[[C_0_R]] : i128151  ! CHECK: %[[OVER_R:.*]] = arith.cmpi sge, %[[S_CONV]], %[[C_BITS_R]] : i128152  ! CHECK: %[[INV_R:.*]] = arith.ori %[[UNDER_R]], %[[OVER_R]] : i1153  ! CHECK: %[[SHR:.*]] = arith.shrui %[[B_VAL]], %[[S_CONV]] : i128154  ! CHECK: %[[RGT:.*]] = arith.select %[[INV_R]], %[[C_0_R]], %[[SHR]] : i128155  ! CHECK: %[[SHIFT:.*]] = arith.ori %[[LFT]], %[[RGT]] : i128156end subroutine dshiftr16_test157