1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc < %s -mtriple=x86_64 | FileCheck %s
4 define zeroext i32 @trunc_nuw_nsw_urem(i64 %x) nounwind {
5 ; CHECK-LABEL: trunc_nuw_nsw_urem:
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: movq %rdi, %rax
8 ; CHECK-NEXT: movl $3518437209, %ecx # imm = 0xD1B71759
9 ; CHECK-NEXT: imulq %rdi, %rcx
10 ; CHECK-NEXT: shrq $45, %rcx
11 ; CHECK-NEXT: imull $10000, %ecx, %ecx # imm = 0x2710
12 ; CHECK-NEXT: subl %ecx, %eax
13 ; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
16 %trunc = trunc nuw nsw i64 %x to i32
17 %rem = urem i32 %trunc, 10000
21 define i64 @zext_nneg_udiv_trunc_nuw(i64 %x) nounwind {
22 ; CHECK-LABEL: zext_nneg_udiv_trunc_nuw:
23 ; CHECK: # %bb.0: # %entry
24 ; CHECK-NEXT: imull $52429, %edi, %eax # imm = 0xCCCD
25 ; CHECK-NEXT: shrl $23, %eax
28 %trunc = trunc nuw i64 %x to i16
29 %div = udiv i16 %trunc, 160
30 %ext = zext nneg i16 %div to i64
34 define i64 @sext_udiv_trunc_nuw(i64 %x) nounwind {
35 ; CHECK-LABEL: sext_udiv_trunc_nuw:
36 ; CHECK: # %bb.0: # %entry
37 ; CHECK-NEXT: imull $52429, %edi, %eax # imm = 0xCCCD
38 ; CHECK-NEXT: shrl $23, %eax
41 %trunc = trunc nuw i64 %x to i16
42 %div = udiv i16 %trunc, 160
43 %ext = sext i16 %div to i64
47 define ptr @gep_nusw_zext_nneg_add_trunc_nuw_nsw(ptr %p, i64 %x) nounwind {
48 ; CHECK-LABEL: gep_nusw_zext_nneg_add_trunc_nuw_nsw:
49 ; CHECK: # %bb.0: # %entry
50 ; CHECK-NEXT: leaq 20(%rdi,%rsi,4), %rax
53 %trunc = trunc nuw nsw i64 %x to i32
54 %add = add nuw nsw i32 %trunc, 5
55 %offset = zext nneg i32 %add to i64
56 %gep = getelementptr nusw float, ptr %p, i64 %offset
60 ; Make sure nsw flag is dropped after we simplify the operand of TRUNCATE.
62 define i32 @simplify_demanded_bits_drop_flag(i1 zeroext %x, i1 zeroext %y) nounwind {
63 ; CHECK-LABEL: simplify_demanded_bits_drop_flag:
64 ; CHECK: # %bb.0: # %entry
65 ; CHECK-NEXT: negl %edi
66 ; CHECK-NEXT: shll $2, %esi
67 ; CHECK-NEXT: xorl %edi, %esi
68 ; CHECK-NEXT: movslq %esi, %rax
69 ; CHECK-NEXT: imulq $-1634202141, %rax, %rax # imm = 0x9E980DE3
70 ; CHECK-NEXT: movq %rax, %rcx
71 ; CHECK-NEXT: shrq $63, %rcx
72 ; CHECK-NEXT: sarq $44, %rax
73 ; CHECK-NEXT: addl %ecx, %eax
74 ; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
77 %sel = select i1 %y, i64 4, i64 0
78 %conv0 = sext i1 %x to i64
79 %xor = xor i64 %sel, %conv0
80 %conv1 = trunc nsw i64 %xor to i32
81 %div = sdiv i32 %conv1, -10765