xref: /llvm-project/llvm/test/CodeGen/PowerPC/shift-cmp.ll (revision 2d9890775f523a7a7ed2d7d064273bf7e28ebf20)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple powerpc64le-unknown-linux-gnu < %s | FileCheck %s
3; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s
4
5define i1 @and_cmp_variable_power_of_two(i32 %x, i32 %y) {
6; CHECK-LABEL: and_cmp_variable_power_of_two:
7; CHECK:       # %bb.0:
8; CHECK-NEXT:    srw 3, 3, 4
9; CHECK-NEXT:    blr
10  %shl = shl i32 1, %y
11  %and = and i32 %x, %shl
12  %cmp = icmp eq i32 %and, %shl
13  ret i1 %cmp
14}
15
16define i1 @and_cmp_variable_power_of_two_64(i64 %x, i64 %y) {
17; CHECK-LABEL: and_cmp_variable_power_of_two_64:
18; CHECK:       # %bb.0:
19; CHECK-NEXT:    srd 3, 3, 4
20; CHECK-NEXT:    blr
21  %shl = shl i64 1, %y
22  %and = and i64 %x, %shl
23  %cmp = icmp eq i64 %and, %shl
24  ret i1 %cmp
25}
26
27define i1 @and_ncmp_variable_power_of_two(i32 %x, i32 %y) {
28; CHECK-LABEL: and_ncmp_variable_power_of_two:
29; CHECK:       # %bb.0:
30; CHECK-NEXT:    srw 3, 3, 4
31; CHECK-NEXT:    xori 3, 3, 1
32; CHECK-NEXT:    blr
33  %shl = shl i32 1, %y
34  %and = and i32 %x, %shl
35  %cmp = icmp ne i32 %and, %shl
36  ret i1 %cmp
37}
38
39define i1 @and_ncmp_variable_power_of_two_64(i64 %x, i64 %y) {
40; CHECK-LABEL: and_ncmp_variable_power_of_two_64:
41; CHECK:       # %bb.0:
42; CHECK-NEXT:    srd 3, 3, 4
43; CHECK-NEXT:    xori 3, 3, 1
44; CHECK-NEXT:    blr
45  %shl = shl i64 1, %y
46  %and = and i64 %x, %shl
47  %cmp = icmp ne i64 %and, %shl
48  ret i1 %cmp
49}
50