1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s | FileCheck %s
3target datalayout = "e-m:e-i64:64-n32:64"
4target triple = "powerpc64le-unknown-linux-gnu"
5
6define i1 @and_cmp_variable_power_of_two(i32 %x, i32 %y) {
7; CHECK-LABEL: and_cmp_variable_power_of_two:
8; CHECK:       # %bb.0:
9; CHECK-NEXT:    subfic 4, 4, 32
10; CHECK-NEXT:    rlwnm 3, 3, 4, 31, 31
11; CHECK-NEXT:    blr
12  %shl = shl i32 1, %y
13  %and = and i32 %x, %shl
14  %cmp = icmp eq i32 %and, %shl
15  ret i1 %cmp
16}
17
18define i1 @and_cmp_variable_power_of_two_64(i64 %x, i64 %y) {
19; CHECK-LABEL: and_cmp_variable_power_of_two_64:
20; CHECK:       # %bb.0:
21; CHECK-NEXT:    subfic 4, 4, 64
22; CHECK-NEXT:    rldcl 3, 3, 4, 63
23; CHECK-NEXT:    blr
24  %shl = shl i64 1, %y
25  %and = and i64 %x, %shl
26  %cmp = icmp eq i64 %and, %shl
27  ret i1 %cmp
28}
29
30define i1 @and_ncmp_variable_power_of_two(i32 %x, i32 %y) {
31; CHECK-LABEL: and_ncmp_variable_power_of_two:
32; CHECK:       # %bb.0:
33; CHECK-NEXT:    subfic 4, 4, 32
34; CHECK-NEXT:    nor 3, 3, 3
35; CHECK-NEXT:    rlwnm 3, 3, 4, 31, 31
36; CHECK-NEXT:    blr
37  %shl = shl i32 1, %y
38  %and = and i32 %x, %shl
39  %cmp = icmp ne i32 %and, %shl
40  ret i1 %cmp
41}
42
43define i1 @and_ncmp_variable_power_of_two_64(i64 %x, i64 %y) {
44; CHECK-LABEL: and_ncmp_variable_power_of_two_64:
45; CHECK:       # %bb.0:
46; CHECK-NEXT:    not 3, 3
47; CHECK-NEXT:    subfic 4, 4, 64
48; CHECK-NEXT:    rldcl 3, 3, 4, 63
49; CHECK-NEXT:    blr
50  %shl = shl i64 1, %y
51  %and = and i64 %x, %shl
52  %cmp = icmp ne i64 %and, %shl
53  ret i1 %cmp
54}
55