blob: 299b643be7339ee70d3563359ea80108819a5c4d [file] [log] [blame]
Hal Finkela39fd4b2016-09-02 02:34:44 +00001; RUN: llc < %s | FileCheck %s
2target datalayout = "e-m:e-i64:64-n32:64"
3target triple = "powerpc64le-unknown-linux-gnu"
4
5define i1 @and_cmp_variable_power_of_two(i32 %x, i32 %y) {
6 %shl = shl i32 1, %y
7 %and = and i32 %x, %shl
8 %cmp = icmp eq i32 %and, %shl
9 ret i1 %cmp
10
11; CHECK-LABEL: @and_cmp_variable_power_of_two
12; CHECK: subfic 4, 4, 32
13; CHECK: rlwnm 3, 3, 4, 31, 31
14; CHECK: blr
15}
16
17define i1 @and_cmp_variable_power_of_two_64(i64 %x, i64 %y) {
18 %shl = shl i64 1, %y
19 %and = and i64 %x, %shl
20 %cmp = icmp eq i64 %and, %shl
21 ret i1 %cmp
22
23; CHECK-LABEL: @and_cmp_variable_power_of_two_64
24; CHECK: subfic 4, 4, 64
25; CHECK: rldcl 3, 3, 4, 63
26; CHECK: blr
27}
28
29define i1 @and_ncmp_variable_power_of_two(i32 %x, i32 %y) {
30 %shl = shl i32 1, %y
31 %and = and i32 %x, %shl
32 %cmp = icmp ne i32 %and, %shl
33 ret i1 %cmp
34
35; CHECK-LABEL: @and_ncmp_variable_power_of_two
36; CHECK-DAG: subfic 4, 4, 32
37; CHECK-DAG: nor [[REG:[0-9]+]], 3, 3
38; CHECK: rlwnm 3, [[REG]], 4, 31, 31
39; CHECK: blr
40}
41
42define i1 @and_ncmp_variable_power_of_two_64(i64 %x, i64 %y) {
43 %shl = shl i64 1, %y
44 %and = and i64 %x, %shl
45 %cmp = icmp ne i64 %and, %shl
46 ret i1 %cmp
47
48; CHECK-LABEL: @and_ncmp_variable_power_of_two_64
49; CHECK-DAG: subfic 4, 4, 64
50; CHECK-DAG: not [[REG:[0-9]+]], 3
51; CHECK: rldcl 3, [[REG]], 4, 63
52; CHECK: blr
53}
54