; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
; A bug in X86DAGToDAGISel::matchAddressRecursively create a zext SDValue which
; is quickly replaced by other SDValue but already pushed into vector for later
; calling for SelectionDAGISel::Select_INLINEASM getNode builder, see issue
; 82431 for more infomation.
define i64 @PR82431_0(i8 %call, ptr %b) {
; CHECK-LABEL: PR82431_0:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movzbl %dil, %eax
; CHECK-NEXT: movq 8(%rsi,%rax,8), %rax
; CHECK-NEXT: retq
entry:
%narrow = add nuw i8 %call, 1
%idxprom = zext i8 %narrow to i64
%arrayidx = getelementptr [1 x i64], ptr %b, i64 0, i64 %idxprom
%ret_val = load i64, ptr %arrayidx
ret i64 %ret_val
}
define i32 @PR82431_1(i32 %0, ptr %f) {
; CHECK-LABEL: PR82431_1:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
; CHECK-NEXT: addl %edi, %edi
; CHECK-NEXT: andl $8, %edi
; CHECK-NEXT: movl 4(%rsi,%rdi), %eax
; CHECK-NEXT: retq
entry:
%shr = lshr i32 %0, 1
%and = and i32 %shr, 2
%add = or i32 %and, 1
%idxprom = zext i32 %add to i64
%arrayidx = getelementptr [0 x i32], ptr %f, i64 0, i64 %idxprom
%ret_val = load i32, ptr %arrayidx
ret i32 %ret_val
}
define void @PR82431_2(i8 %call, ptr %b) {
; CHECK-LABEL: PR82431_2:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movzbl %dil, %eax
; CHECK-NEXT: #APP
; CHECK-NEXT: #NO_APP
; CHECK-NEXT: retq
entry:
%narrow = add nuw i8 %call, 1
%idxprom = zext i8 %narrow to i64
%arrayidx = getelementptr [1 x i64], ptr %b, i64 0, i64 %idxprom
tail call void asm "", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %arrayidx, ptr elementtype(i64) %arrayidx)
ret void
}
define void @PR82431_3(i32 %0, ptr %f) {
; CHECK-LABEL: PR82431_3:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
; CHECK-NEXT: addl %edi, %edi
; CHECK-NEXT: andl $8, %edi
; CHECK-NEXT: #APP
; CHECK-NEXT: #NO_APP
; CHECK-NEXT: retq
entry:
%shr = lshr i32 %0, 1
%and = and i32 %shr, 2
%add = or i32 %and, 1
%idxprom = zext i32 %add to i64
%arrayidx = getelementptr [0 x i32], ptr %f, i64 0, i64 %idxprom
tail call void asm "", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %arrayidx, ptr elementtype(i32) %arrayidx)
ret void
}