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 AssertSext node
5; PR20494
6
7define i64 @main(i64 %a) {
8; CHECK-LABEL: main:
9; CHECK:       # %bb.0:
10; CHECK-NEXT:    orq $-2, %rdi
11; CHECK-NEXT:    movl %edi, %eax
12; CHECK-NEXT:    retq
13  %or = or i64 %a, -2
14  %trunc = trunc i64 %or to i32
15  br label %l
16l:
17  %ext = zext i32 %trunc to i64
18  trunc i64 %or to i32 ; to keep the or from being narrowed
19  ret i64 %ext
20}
21