blob: 21b25d87796a59c97c7f3a808448861a686481c7 [file] [log] [blame] [edit]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefixes=POSTRA
; RUN: llc < %s -mtriple=x86_64-- -mcpu=haswell | FileCheck %s --check-prefixes=NOPOSTRA
; RUN: llc < %s -mtriple=x86_64-- -mcpu=x86-64-v3 | FileCheck %s --check-prefixes=NOPOSTRA
; Ensure reloads are after narrowed i512 -> i32 store
define i1 @PR166744(ptr %v, i64 %idx, i1 zeroext %b) {
; POSTRA-LABEL: PR166744:
; POSTRA: # %bb.0:
; POSTRA-NEXT: movl $1029, %eax # imm = 0x405
; POSTRA-NEXT: shlxl %esi, %edx, %edx
; POSTRA-NEXT: bextrl %eax, %esi, %eax
; POSTRA-NEXT: movl (%rdi,%rax,4), %ecx
; POSTRA-NEXT: btrl %esi, %ecx
; POSTRA-NEXT: orl %ecx, %edx
; POSTRA-NEXT: movl %edx, (%rdi,%rax,4)
; POSTRA-NEXT: movq 16(%rdi), %rax
; POSTRA-NEXT: movq (%rdi), %rcx
; POSTRA-NEXT: movq 24(%rdi), %rdx
; POSTRA-NEXT: movq 8(%rdi), %rsi
; POSTRA-NEXT: orq 56(%rdi), %rdx
; POSTRA-NEXT: orq 40(%rdi), %rsi
; POSTRA-NEXT: orq 48(%rdi), %rax
; POSTRA-NEXT: orq 32(%rdi), %rcx
; POSTRA-NEXT: orq %rdx, %rsi
; POSTRA-NEXT: orq %rax, %rcx
; POSTRA-NEXT: orq %rsi, %rcx
; POSTRA-NEXT: setne %al
; POSTRA-NEXT: retq
;
; NOPOSTRA-LABEL: PR166744:
; NOPOSTRA: # %bb.0:
; NOPOSTRA-NEXT: movl %esi, %eax
; NOPOSTRA-NEXT: shrl $3, %eax
; NOPOSTRA-NEXT: andl $60, %eax
; NOPOSTRA-NEXT: movl (%rdi,%rax), %ecx
; NOPOSTRA-NEXT: btrl %esi, %ecx
; NOPOSTRA-NEXT: shlxl %esi, %edx, %edx
; NOPOSTRA-NEXT: orl %ecx, %edx
; NOPOSTRA-NEXT: movl %edx, (%rdi,%rax)
; NOPOSTRA-NEXT: movq 16(%rdi), %rax
; NOPOSTRA-NEXT: movq (%rdi), %rcx
; NOPOSTRA-NEXT: movq 8(%rdi), %rdx
; NOPOSTRA-NEXT: movq 24(%rdi), %rsi
; NOPOSTRA-NEXT: orq 56(%rdi), %rsi
; NOPOSTRA-NEXT: orq 40(%rdi), %rdx
; NOPOSTRA-NEXT: orq 48(%rdi), %rax
; NOPOSTRA-NEXT: orq 32(%rdi), %rcx
; NOPOSTRA-NEXT: orq %rsi, %rdx
; NOPOSTRA-NEXT: orq %rax, %rcx
; NOPOSTRA-NEXT: orq %rdx, %rcx
; NOPOSTRA-NEXT: setne %al
; NOPOSTRA-NEXT: retq
%rem = and i64 %idx, 511
%sh_prom = zext nneg i64 %rem to i512
%shl = shl nuw i512 1, %sh_prom
%not = xor i512 %shl, -1
%load = load i512, ptr %v, align 8
%and = and i512 %load, %not
%conv2 = zext i1 %b to i512
%shl4 = shl nuw i512 %conv2, %sh_prom
%or = or i512 %and, %shl4
store i512 %or, ptr %v, align 8
%cmp = icmp ne i512 %or, 0
ret i1 %cmp
}