xref: /llvm-project/llvm/test/CodeGen/X86/pr27202.ll (revision 38c799bce8016f7487067a031b62cf98069aaa4d)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3
4define i1 @foo(i32 %i) optsize {
5; CHECK-LABEL: foo:
6; CHECK:       # %bb.0:
7; CHECK-NEXT:    notl %edi
8; CHECK-NEXT:    testl $305419896, %edi # imm = 0x12345678
9; CHECK-NEXT:    sete %al
10; CHECK-NEXT:    retq
11  %and = and i32 %i, 305419896
12  %cmp = icmp eq i32 %and, 305419896
13  ret i1 %cmp
14}
15
16define i1 @foo_pgso(i32 %i) !prof !14 {
17; CHECK-LABEL: foo_pgso:
18; CHECK:       # %bb.0:
19; CHECK-NEXT:    notl %edi
20; CHECK-NEXT:    testl $305419896, %edi # imm = 0x12345678
21; CHECK-NEXT:    sete %al
22; CHECK-NEXT:    retq
23  %and = and i32 %i, 305419896
24  %cmp = icmp eq i32 %and, 305419896
25  ret i1 %cmp
26}
27
28; 8-bit ALU immediates probably have small encodings.
29; We do not want to hoist the constant into a register here.
30
31define zeroext i1 @g(i32 %x) optsize {
32; CHECK-LABEL: g:
33; CHECK:       # %bb.0:
34; CHECK-NEXT:    testl $-2, %edi
35; CHECK-NEXT:    sete %al
36; CHECK-NEXT:    retq
37  %t0 = or i32 %x, 1
38  %t1 = icmp eq i32 %t0, 1
39  ret i1 %t1
40}
41
42; 8-bit ALU immediates probably have small encodings.
43; We do not want to hoist the constant into a register here.
44
45define i64 @PR46237(i64 %x, i64 %y, i64 %z) optsize {
46; CHECK-LABEL: PR46237:
47; CHECK:       # %bb.0:
48; CHECK-NEXT:    movl %edx, %eax
49; CHECK-NEXT:    shll $6, %eax
50; CHECK-NEXT:    movzbl %al, %ecx
51; CHECK-NEXT:    andl $7, %esi
52; CHECK-NEXT:    andl $7, %edx
53; CHECK-NEXT:    leaq (%rdx,%rsi,8), %rax
54; CHECK-NEXT:    orq %rcx, %rax
55; CHECK-NEXT:    retq
56  %and = shl i64 %z, 6
57  %shl = and i64 %and, 192
58  %and1 = shl i64 %y, 3
59  %shl2 = and i64 %and1, 56
60  %and3 = and i64 %z, 7
61  %or = or i64 %and3, %shl2
62  %or4 = or i64 %or, %shl
63  ret i64 %or4
64}
65
66!llvm.module.flags = !{!0}
67!0 = !{i32 1, !"ProfileSummary", !1}
68!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
69!2 = !{!"ProfileFormat", !"InstrProf"}
70!3 = !{!"TotalCount", i64 10000}
71!4 = !{!"MaxCount", i64 10}
72!5 = !{!"MaxInternalCount", i64 1}
73!6 = !{!"MaxFunctionCount", i64 1000}
74!7 = !{!"NumCounts", i64 3}
75!8 = !{!"NumFunctions", i64 3}
76!9 = !{!"DetailedSummary", !10}
77!10 = !{!11, !12, !13}
78!11 = !{i32 10000, i64 100, i32 1}
79!12 = !{i32 999000, i64 100, i32 1}
80!13 = !{i32 999999, i64 1, i32 2}
81!14 = !{!"function_entry_count", i64 0}
82