File: and-cmpz-to-shift.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 (46 lines) | stat: -rw-r--r-- 1,365 bytes parent folder | download | duplicates (6)
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=thumbv6m %s -o - | FileCheck %s --check-prefix=T1
; RUN: llc -mtriple=thumbv7m %s -o - | FileCheck %s --check-prefix=T2

define void @test(i32 %x, i32 %a, i32 %b, i32 %c, i32 %d, ptr %p1, ptr %p2) {
; T1-LABEL: test:
; T1:       @ %bb.0:
; T1-NEXT:    push {r4, lr}
; T1-NEXT:    movs r4, #1
; T1-NEXT:    lsls r4, r4, #24
; T1-NEXT:    tst r0, r4
; T1-NEXT:    beq .LBB0_2
; T1-NEXT:  @ %bb.1:
; T1-NEXT:    mov r1, r2
; T1-NEXT:  .LBB0_2:
; T1-NEXT:    ldr r0, [sp, #12]
; T1-NEXT:    str r1, [r0]
; T1-NEXT:    beq .LBB0_4
; T1-NEXT:  @ %bb.3:
; T1-NEXT:    ldr r3, [sp, #8]
; T1-NEXT:  .LBB0_4:
; T1-NEXT:    ldr r0, [sp, #16]
; T1-NEXT:    str r3, [r0]
; T1-NEXT:    pop {r4, pc}
;
; T2-LABEL: test:
; T2:       @ %bb.0:
; T2-NEXT:    tst.w r0, #16777216
; T2-NEXT:    ldr r0, [sp, #4]
; T2-NEXT:    it ne
; T2-NEXT:    movne r1, r2
; T2-NEXT:    str r1, [r0]
; T2-NEXT:    ldr r1, [sp, #8]
; T2-NEXT:    ldr r0, [sp]
; T2-NEXT:    it eq
; T2-NEXT:    moveq r0, r3
; T2-NEXT:    str r0, [r1]
; T2-NEXT:    bx lr
  %and = and i32 %x, u0x1000000
  %cmp = icmp eq i32 %and, 0
  %sel1 = select i1 %cmp, i32 %a, i32 %b
  %sel2 = select i1 %cmp, i32 %c, i32 %d
  store i32 %sel1, ptr %p1, align 4
  store i32 %sel2, ptr %p2, align 4
  ret void
}