File: 2017-07-07-UMul-ZExt.ll

package info (click to toggle)
llvm-toolchain-5.0 1:5.0.1-2~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 553,688 kB
  • sloc: cpp: 2,878,786; ansic: 584,110; asm: 246,252; python: 124,751; objc: 106,925; sh: 21,542; lisp: 8,628; pascal: 5,885; ml: 5,544; perl: 5,312; makefile: 2,208; cs: 2,022; xml: 686; php: 212; csh: 117
file content (51 lines) | stat: -rw-r--r-- 1,924 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instcombine -S | FileCheck %s

define i32 @sterix(i32, i8, i64) {
; CHECK-LABEL: @sterix(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[CONV:%.*]] = zext i32 [[TMP0:%.*]] to i64
; CHECK-NEXT:    [[CONV1:%.*]] = sext i8 [[TMP1:%.*]] to i32
; CHECK-NEXT:    [[MUL:%.*]] = mul i32 [[CONV1]], 1945964878
; CHECK-NEXT:    [[SH_PROM:%.*]] = trunc i64 [[TMP2:%.*]] to i32
; CHECK-NEXT:    [[SHR:%.*]] = lshr i32 [[MUL]], [[SH_PROM]]
; CHECK-NEXT:    [[CONV2:%.*]] = zext i32 [[SHR]] to i64
; CHECK-NEXT:    [[MUL3:%.*]] = mul nuw nsw i64 [[CONV]], [[CONV2]]
; CHECK-NEXT:    [[CONV6:%.*]] = and i64 [[MUL3]], 4294967295
; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp eq i64 [[CONV6]], [[MUL3]]
; CHECK-NEXT:    br i1 [[TOBOOL]], label [[LOR_RHS:%.*]], label [[LOR_END:%.*]]
; CHECK:       lor.rhs:
; CHECK-NEXT:    [[AND:%.*]] = and i64 [[MUL3]], [[TMP2]]
; CHECK-NEXT:    [[CONV4:%.*]] = trunc i64 [[AND]] to i32
; CHECK-NEXT:    [[TOBOOL7:%.*]] = icmp eq i32 [[CONV4]], 0
; CHECK-NEXT:    [[PHITMP:%.*]] = zext i1 [[TOBOOL7]] to i32
; CHECK-NEXT:    br label [[LOR_END]]
; CHECK:       lor.end:
; CHECK-NEXT:    [[TMP3:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ [[PHITMP]], [[LOR_RHS]] ]
; CHECK-NEXT:    ret i32 [[TMP3]]
;
entry:
  %conv = zext i32 %0 to i64
  %conv1 = sext i8 %1 to i32
  %mul = mul i32 %conv1, 1945964878
  %sh_prom = trunc i64 %2 to i32
  %shr = lshr i32 %mul, %sh_prom
  %conv2 = zext i32 %shr to i64
  %mul3 = mul nuw nsw i64 %conv, %conv2
  %conv6 = and i64 %mul3, 4294967295
  %tobool = icmp ne i64 %conv6, %mul3
  br i1 %tobool, label %lor.end, label %lor.rhs

lor.rhs:
  %and = and i64 %2, %mul3
  %conv4 = trunc i64 %and to i32
  %tobool7 = icmp ne i32 %conv4, 0
  %lnot = xor i1 %tobool7, true
  br label %lor.end

lor.end:
  %3 = phi i1 [ true, %entry ], [ %lnot, %lor.rhs ]
  %conv8 = zext i1 %3 to i32
  ret i32 %conv8
}