1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
4 ! CHECK-LABEL: ibits_test
5 function ibits_test(i
, j
, k
)
6 ! CHECK-DAG: %[[result:.*]] = fir.alloca i32 {bindc_name = "ibits_test"
7 ! CHECK-DAG: %[[i:.*]] = fir.load %arg0 : !fir.ref<i32>
8 ! CHECK-DAG: %[[j:.*]] = fir.load %arg1 : !fir.ref<i32>
9 ! CHECK-DAG: %[[k:.*]] = fir.load %arg2 : !fir.ref<i32>
10 ! CHECK-DAG: %[[VAL_7:.*]] = arith.constant 32 : i32
11 ! CHECK-DAG: %[[VAL_8:.*]] = arith.subi %[[VAL_7]], %[[k]] : i32
12 ! CHECK-DAG: %[[VAL_9:.*]] = arith.constant 0 : i32
13 ! CHECK-DAG: %[[VAL_10:.*]] = arith.constant -1 : i32
14 ! CHECK: %[[VAL_11:.*]] = arith.shrui %[[VAL_10]], %[[VAL_8]] : i32
15 ! CHECK: %[[VAL_12:.*]] = arith.shrsi %[[i]], %[[j]] : i32
16 ! CHECK: %[[VAL_13:.*]] = arith.andi %[[VAL_12]], %[[VAL_11]] : i32
17 ! CHECK: %[[VAL_14:.*]] = arith.cmpi eq, %[[k]], %[[VAL_9]] : i32
18 ! CHECK: %[[VAL_15:.*]] = arith.select %[[VAL_14]], %[[VAL_9]], %[[VAL_13]] : i32
19 ! CHECK: fir.store %[[VAL_15]] to %[[result]] : !fir.ref<i32>
20 ! CHECK: %[[VAL_16:.*]] = fir.load %[[result]] : !fir.ref<i32>
21 ! CHECK: return %[[VAL_16]] : i32
22 ibits_test
= ibits(i
, j
, k
)