xref: /llvm-project/llvm/test/CodeGen/SPARC/sethiandn.ll (revision 8f0bf6c19af03da36dbcca969f3500fdd4619df9)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=sparc | FileCheck %s -check-prefix=SPARC
3
4define i32 @test_andn(i32 %x) nounwind {
5; SPARC-LABEL: test_andn:
6; SPARC:       ! %bb.0: ! %entry
7; SPARC-NEXT:    sethi 4194272, %o1
8; SPARC-NEXT:    retl
9; SPARC-NEXT:    andn %o0, %o1, %o0
10entry:
11  %and = and i32 %x, 32767
12  ret i32 %and
13}
14
15define i32 @test_orn(i32 %x) nounwind {
16; SPARC-LABEL: test_orn:
17; SPARC:       ! %bb.0: ! %entry
18; SPARC-NEXT:    sethi 4194272, %o1
19; SPARC-NEXT:    retl
20; SPARC-NEXT:    orn %o0, %o1, %o0
21entry:
22  %or = or i32 %x, 32767
23  ret i32 %or
24}
25
26; If constant is used more than once it is probably
27; better to keep it in its original form.
28define i32 @test_used_more_than_once(i32 %x) nounwind {
29; SPARC-LABEL: test_used_more_than_once:
30; SPARC:       ! %bb.0: ! %entry
31; SPARC-NEXT:    sethi 31, %o1
32; SPARC-NEXT:    or %o1, 1023, %o1
33; SPARC-NEXT:    or %o0, %o1, %o2
34; SPARC-NEXT:    and %o0, %o1, %o0
35; SPARC-NEXT:    retl
36; SPARC-NEXT:    xor %o2, %o0, %o0
37entry:
38  %0 = or i32 %x, 32767
39  %and = and i32 %x, 32767
40  %res = xor i32 %0, %and
41  ret i32 %res
42}
43