1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=i686-unknown-linux-gnu < %s | FileCheck %s --check-prefix=X86
3 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=X64
10 ; This needs to be a backend-level fold because only by now pointers
11 ; are just registers; in middle-end IR this can only be done via @llvm.ptrmask()
12 ; intrinsic which is not sufficiently widely-spread yet.
14 ; https://bugs.llvm.org/show_bug.cgi?id=44448
16 ; The basic positive tests
18 define i32 @t0_32(i32 %alignment) nounwind {
21 ; X86-NEXT: xorl %eax, %eax
22 ; X86-NEXT: subl {{[0-9]+}}(%esp), %eax
27 ; X64-NEXT: movl %edi, %eax
30 %mask = add i32 %alignment, -1
31 %invmask = xor i32 %mask, -1
34 define i64 @t1_64(i64 %alignment) nounwind {
37 ; X86-NEXT: xorl %edx, %edx
38 ; X86-NEXT: xorl %eax, %eax
39 ; X86-NEXT: subl {{[0-9]+}}(%esp), %eax
40 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %edx
45 ; X64-NEXT: movq %rdi, %rax
48 %mask = add i64 %alignment, -1
49 %invmask = xor i64 %mask, -1
55 define i32 @t2_extrause(i32 %alignment, ptr %mask_storage) nounwind {
56 ; X86-LABEL: t2_extrause:
58 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
59 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
60 ; X86-NEXT: leal -1(%eax), %edx
61 ; X86-NEXT: movl %edx, (%ecx)
65 ; X64-LABEL: t2_extrause:
67 ; X64-NEXT: movl %edi, %eax
68 ; X64-NEXT: leal -1(%rax), %ecx
69 ; X64-NEXT: movl %ecx, (%rsi)
71 ; X64-NEXT: # kill: def $eax killed $eax killed $rax
73 %mask = add i32 %alignment, -1
74 store i32 %mask, ptr %mask_storage
75 %invmask = xor i32 %mask, -1
81 define i32 @n3_not_dec(i32 %alignment) nounwind {
82 ; X86-LABEL: n3_not_dec:
84 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
89 ; X64-LABEL: n3_not_dec:
91 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
92 ; X64-NEXT: leal 1(%rdi), %eax
95 %mask = add i32 %alignment, 1 ; not -1
96 %invmask = xor i32 %mask, -1
100 define i32 @n4_not_not(i32 %alignment) nounwind {
101 ; X86-LABEL: n4_not_not:
103 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
104 ; X86-NEXT: decl %eax
105 ; X86-NEXT: xorl $1, %eax
108 ; X64-LABEL: n4_not_not:
110 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
111 ; X64-NEXT: leal -1(%rdi), %eax
112 ; X64-NEXT: xorl $1, %eax
114 %mask = add i32 %alignment, -1
115 %invmask = xor i32 %mask, 1 ; not -1