• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-pc-linux-gnu -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X86
3; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X64
4
5; PR8365
6
7define i64 @bra(i32 %zed) nounwind {
8; X86-LABEL: bra:
9; X86:       # %bb.0:
10; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
11; X86-NEXT:    andl $-64, %eax # encoding: [0x83,0xe0,0xc0]
12; X86-NEXT:    xorl %edx, %edx # encoding: [0x31,0xd2]
13; X86-NEXT:    retl # encoding: [0xc3]
14;
15; X64-LABEL: bra:
16; X64:       # %bb.0:
17; X64-NEXT:    # kill: def $edi killed $edi def $rdi
18; X64-NEXT:    andl $-64, %edi # encoding: [0x83,0xe7,0xc0]
19; X64-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
20; X64-NEXT:    retq # encoding: [0xc3]
21 %t1 = zext i32 %zed to i64
22 %t2 = and i64  %t1, 4294967232
23 ret i64 %t2
24}
25
26define void @foo(i64 %zed, i64* %x) nounwind {
27; X86-LABEL: foo:
28; X86:       # %bb.0:
29; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x0c]
30; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx # encoding: [0x8b,0x4c,0x24,0x04]
31; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx # encoding: [0x8b,0x54,0x24,0x08]
32; X86-NEXT:    andl $-4, %ecx # encoding: [0x83,0xe1,0xfc]
33; X86-NEXT:    orl $2, %ecx # encoding: [0x83,0xc9,0x02]
34; X86-NEXT:    movl %edx, 4(%eax) # encoding: [0x89,0x50,0x04]
35; X86-NEXT:    movl %ecx, (%eax) # encoding: [0x89,0x08]
36; X86-NEXT:    retl # encoding: [0xc3]
37;
38; X64-LABEL: foo:
39; X64:       # %bb.0:
40; X64-NEXT:    andq $-4, %rdi # encoding: [0x48,0x83,0xe7,0xfc]
41; X64-NEXT:    orq $2, %rdi # encoding: [0x48,0x83,0xcf,0x02]
42; X64-NEXT:    movq %rdi, (%rsi) # encoding: [0x48,0x89,0x3e]
43; X64-NEXT:    retq # encoding: [0xc3]
44  %t1 = and i64 %zed, -4
45  %t2 = or i64 %t1, 2
46  store i64 %t2, i64* %x, align 8
47  ret void
48}
49
50define i64 @bar(i64 %zed) nounwind {
51; X86-LABEL: bar:
52; X86:       # %bb.0:
53; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
54; X86-NEXT:    andl $42, %eax # encoding: [0x83,0xe0,0x2a]
55; X86-NEXT:    xorl %edx, %edx # encoding: [0x31,0xd2]
56; X86-NEXT:    retl # encoding: [0xc3]
57;
58; X64-LABEL: bar:
59; X64:       # %bb.0:
60; X64-NEXT:    andl $42, %edi # encoding: [0x83,0xe7,0x2a]
61; X64-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
62; X64-NEXT:    retq # encoding: [0xc3]
63  %t1 = and i64 %zed, 42
64  ret i64 %t1
65}
66
67define i64 @baz(i64 %zed) nounwind {
68; X86-LABEL: baz:
69; X86:       # %bb.0:
70; X86-NEXT:    movl $2147483647, %eax # encoding: [0xb8,0xff,0xff,0xff,0x7f]
71; X86-NEXT:    # imm = 0x7FFFFFFF
72; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax # encoding: [0x23,0x44,0x24,0x04]
73; X86-NEXT:    xorl %edx, %edx # encoding: [0x31,0xd2]
74; X86-NEXT:    retl # encoding: [0xc3]
75;
76; X64-LABEL: baz:
77; X64:       # %bb.0:
78; X64-NEXT:    andl $2147483647, %edi # encoding: [0x81,0xe7,0xff,0xff,0xff,0x7f]
79; X64-NEXT:    # imm = 0x7FFFFFFF
80; X64-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
81; X64-NEXT:    retq # encoding: [0xc3]
82  %t1 = and i64 %zed, 2147483647
83  ret i64 %t1
84}
85