File: arm64-cast-opt.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,634,820 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (31 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download | duplicates (12)
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
; RUN: llc -O3 -mtriple arm64-apple-ios5.0.0 < %s | FileCheck %s
; <rdar://problem/15992732>
; Zero truncation is not necessary when the values are extended properly
; already.

@block = common global ptr null, align 8

define zeroext i8 @foo(i32 %i1, i32 %i2) {
; CHECK-LABEL: foo:
; CHECK: cset
; CHECK-NOT: and
entry:
  %idxprom = sext i32 %i1 to i64
  %0 = load ptr, ptr @block, align 8
  %arrayidx = getelementptr inbounds i8, ptr %0, i64 %idxprom
  %1 = load i8, ptr %arrayidx, align 1
  %idxprom1 = sext i32 %i2 to i64
  %arrayidx2 = getelementptr inbounds i8, ptr %0, i64 %idxprom1
  %2 = load i8, ptr %arrayidx2, align 1
  %cmp = icmp eq i8 %1, %2
  br i1 %cmp, label %return, label %if.then

if.then:                                          ; preds = %entry
  %cmp7 = icmp ugt i8 %1, %2
  %conv9 = zext i1 %cmp7 to i8
  br label %return

return:                                           ; preds = %entry, %if.then
  %retval.0 = phi i8 [ %conv9, %if.then ], [ 1, %entry ]
  ret i8 %retval.0
}