File: pr116483.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (36 lines) | stat: -rw-r--r-- 1,188 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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -S -passes=indvars < %s | FileCheck %s

define i32 @test() {
; CHECK-LABEL: define i32 @test() {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[XOR:%.*]] = xor i32 0, 3
; CHECK-NEXT:    [[MUL:%.*]] = mul i32 [[XOR]], 329
; CHECK-NEXT:    [[CONV:%.*]] = trunc i32 [[MUL]] to i16
; CHECK-NEXT:    [[SEXT:%.*]] = shl i16 [[CONV]], 8
; CHECK-NEXT:    [[CONV1:%.*]] = ashr i16 [[SEXT]], 8
; CHECK-NEXT:    br label %[[LOOP_BODY:.*]]
; CHECK:       [[LOOP_BODY]]:
; CHECK-NEXT:    br i1 true, label %[[EXIT:.*]], label %[[LOOP_BODY]]
; CHECK:       [[EXIT]]:
; CHECK-NEXT:    [[CONV3:%.*]] = zext i16 [[CONV1]] to i32
; CHECK-NEXT:    ret i32 [[CONV3]]
;
entry:
  %xor = xor i32 0, 3
  %mul = mul i32 %xor, 329
  %conv = trunc i32 %mul to i16
  %sext = shl i16 %conv, 8
  %conv1 = ashr i16 %sext, 8
  %conv3 = zext i16 %conv1 to i32
  br label %loop.body

loop.body:
  %indvar = phi i32 [ %indvar.inc, %loop.body ], [ 1, %entry ]
  %indvar.inc = add nuw i32 %indvar, 1
  %exitcond = icmp eq i32 %indvar, %conv3
  br i1 %exitcond, label %exit, label %loop.body

exit:
  ret i32 %conv3
}