File: zext-and-cmp.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (33 lines) | stat: -rw-r--r-- 1,019 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
32
33
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu  < %s | FileCheck %s

; Test that we recognize that an 'and' instruction that feeds a comparison
; to zero can be simplifed by using the record form when one of its operands
; is known to be zero extended.

@k = local_unnamed_addr global i32 0, align 4

; Function Attrs: norecurse nounwind
define signext i32 @cmplwi(ptr nocapture readonly %p, ptr nocapture readonly %q, i32 signext %j, i32 signext %r10) {
entry:
  %0 = load i32, ptr %q, align 4
  %shl = shl i32 %0, %j
  %1 = load i32, ptr %p, align 4
  %and = and i32 %shl, %r10
  %and1 = and i32 %and, %1
  %tobool = icmp eq i32 %and1, 0
  br i1 %tobool, label %cleanup, label %if.then

if.then:
  store i32 %j, ptr @k, align 4
  br label %cleanup

cleanup:
  %retval.0 = phi i32 [ 0, %if.then ], [ 1, %entry ]
  ret i32 %retval.0
}

; CHECK-LABEL: cmplwi:
; CHECK:      lwz [[T1:[0-9]+]], 0(3)
; CHECK:      and. {{[0-9]+}}, {{[0-9]+}}, [[T1]]
; CHECK-NOT:  cmplwi
; CHECK-NEXT: beq      0,