1
; RUN: opt -S -instcombine < %s | FileCheck %s
5
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
6
target triple = "x86_64-apple-macosx10.8.0"
8
; CHECK-LABEL: @udiv400(
9
; CHECK: udiv i32 %x, 400
11
define i32 @udiv400(i32 %x) {
14
%div1 = udiv i32 %div, 100
19
; CHECK-LABEL: @udiv400_no(
23
define i32 @udiv400_no(i32 %x) {
26
%div1 = udiv i32 %div, 100
30
; CHECK-LABEL: @sdiv400_yes(
31
; CHECK: udiv i32 %x, 400
33
define i32 @sdiv400_yes(i32 %x) {
36
; The sign bits of both operands are zero (i.e. we can prove they are
37
; unsigned inputs), turn this into a udiv.
38
; Next, optimize this just like sdiv.
39
%div1 = sdiv i32 %div, 100
44
; CHECK-LABEL: @udiv_i80(
45
; CHECK: udiv i80 %x, 400
47
define i80 @udiv_i80(i80 %x) {
49
%div1 = udiv i80 %div, 100
53
define i32 @no_crash_notconst_udiv(i32 %x, i32 %notconst) {
54
%div = lshr i32 %x, %notconst
55
%div1 = udiv i32 %div, 100