1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -O2 -mtriple=x86_64-unknown-unknown | FileCheck %s 3; Checks that a zeroing mov is inserted for the trunc/zext pair even when 4; the source of the zext is an AssertZext node 5; PR28540 6 7define i64 @foo() { 8; CHECK-LABEL: foo: 9; CHECK: # %bb.0: 10; CHECK-NEXT: movq $-1, %rax 11; CHECK-NEXT: retq 12 ret i64 -1 13} 14 15define i64 @main() { 16; CHECK-LABEL: main: 17; CHECK: # %bb.0: 18; CHECK-NEXT: pushq %rax 19; CHECK-NEXT: .cfi_def_cfa_offset 16 20; CHECK-NEXT: callq foo 21; CHECK-NEXT: movabsq $-4294967041, %rcx # imm = 0xFFFFFFFF000000FF 22; CHECK-NEXT: andq %rax, %rcx 23; CHECK-NEXT: movl %ecx, %ecx 24; CHECK-NEXT: leaq (,%rcx,8), %rax 25; CHECK-NEXT: subq %rcx, %rax 26; CHECK-NEXT: shrq $32, %rax 27; CHECK-NEXT: popq %rcx 28; CHECK-NEXT: .cfi_def_cfa_offset 8 29; CHECK-NEXT: retq 30 %b = call i64 @foo() 31 %or = and i64 %b, 18446744069414584575 ; this is 0xffffffff000000ff 32 %trunc = trunc i64 %or to i32 33 br label %l 34l: 35 %ext = zext i32 %trunc to i64 36 %mul = mul i64 %ext, 7 37 br label %m 38m: ; keeps dag combine from seeing the multiply and the shift together 39 %shr = lshr i64 %mul, 32 40 trunc i64 %or to i32 ; keeps the and alive so it doesn't simplify 41 ret i64 %shr 42} 43