1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
4 ! CHECK-LABEL: trailz1_test
5 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i8>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
6 subroutine trailz1_test(a
, b
)
10 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i8>
12 ! CHECK: %[[COUNT:.*]] = math.cttz %[[AVAL]] : i8
13 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i8) -> i32
14 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
15 end subroutine trailz1_test
17 ! CHECK-LABEL: trailz2_test
18 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i16>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
19 subroutine trailz2_test(a
, b
)
23 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i16>
25 ! CHECK: %[[COUNT:.*]] = math.cttz %[[AVAL]] : i16
26 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i16) -> i32
27 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
28 end subroutine trailz2_test
30 ! CHECK-LABEL: trailz4_test
31 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i32>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
32 subroutine trailz4_test(a
, b
)
36 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i32>
38 ! CHECK: %[[RESULT:.*]] = math.cttz %[[AVAL]] : i32
39 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
40 end subroutine trailz4_test
42 ! CHECK-LABEL: trailz8_test
43 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i64>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
44 subroutine trailz8_test(a
, b
)
48 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i64>
50 ! CHECK: %[[COUNT:.*]] = math.cttz %[[AVAL]] : i64
51 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i64) -> i32
52 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
53 end subroutine trailz8_test
55 ! CHECK-LABEL: trailz16_test
56 ! CHECK-SAME: %[[AREF:.*]]: !fir.ref<i128>{{.*}}, %[[BREF:.*]]: !fir.ref<i32>{{.*}}
57 subroutine trailz16_test(a
, b
)
61 ! CHECK: %[[AVAL:.*]] = fir.load %[[AREF]] : !fir.ref<i128>
63 ! CHECK: %[[COUNT:.*]] = math.cttz %[[AVAL]] : i128
64 ! CHECK: %[[RESULT:.*]] = fir.convert %[[COUNT]] : (i128) -> i32
65 ! CHECK: fir.store %[[RESULT]] to %[[BREF]] : !fir.ref<i32>
66 end subroutine trailz16_test