1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs | FileCheck %s
4 ; FIXME: We have implemented the following patterns in DAGCombiner.cpp,
5 ; but we can't get results as expected.
7 ; fold (or (and X, (xor Y, -1)), Y) to (or X, Y)
8 define i32 @pattern1(i32 %x, i32 %y){
9 ; CHECK-LABEL: pattern1:
11 ; CHECK-NEXT: xori 5, 4, 65535
12 ; CHECK-NEXT: xoris 5, 5, 65535
13 ; CHECK-NEXT: and 3, 3, 5
14 ; CHECK-NEXT: or 3, 3, 4
22 ; fold (or (and (xor Y, -1), X), Y) to (or X, Y)
23 define i32 @pattern2(i32 %x, i32 %y){
24 ; CHECK-LABEL: pattern2:
26 ; CHECK-NEXT: xori 5, 4, 65535
27 ; CHECK-NEXT: xoris 5, 5, 65535
28 ; CHECK-NEXT: and 3, 5, 3
29 ; CHECK-NEXT: or 3, 3, 4
37 ; fold (and (select Cond, 0, -1), X) to (select Cond, 0, X)
38 define i32 @pattern3(i1 %cond, i32 %x) {
39 ; CHECK-LABEL: pattern3:
41 ; CHECK-NEXT: andi. 3, 3, 1
42 ; CHECK-NEXT: li 3, -1
43 ; CHECK-NEXT: rldic 3, 3, 0, 32
44 ; CHECK-NEXT: iselgt 3, 0, 3
45 ; CHECK-NEXT: and 3, 3, 4
47 %sel = select i1 %cond, i32 0, i32 -1
48 %res = and i32 %sel, %x
52 ; fold (or X, (select Cond, -1, 0)) to (select Cond, -1, X)
53 define i32 @pattern4(i1 %cond, i32 %x) {
54 ; CHECK-LABEL: pattern4:
56 ; CHECK-NEXT: andi. 3, 3, 1
57 ; CHECK-NEXT: li 3, -1
59 ; CHECK-NEXT: rldic 3, 3, 0, 32
60 ; CHECK-NEXT: iselgt 3, 3, 5
61 ; CHECK-NEXT: or 3, 4, 3
63 %sel = select i1 %cond, i32 -1, i32 0
64 %res = or i32 %x, %sel