File: add-like-or.ll

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 995,836 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (41 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download | duplicates (7)
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
; RUN: llc -mtriple=thumbv6m-apple-macho %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-T1
; RUN: llc -mtriple=thumbv7m-apple-macho %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-T2

define i32 @test_add_i3(i1 %tst, i32 %a, i32 %b) {
; CHECK-LABEL: test_add_i3:
; CHECK: adds r0, {{r[0-9]+}}, #2
  %tmp = and i32 %a, -7
  %tmp1 = and i32 %b, -4
  %int = select i1 %tst, i32 %tmp, i32 %tmp1

  ; Call to force %int into a register that isn't r0 so using the i3 form is a
  ; good idea.
  call void @foo(i32 %int)
  %res = or i32 %int, 2
  ret i32 %res
}

define i32 @test_add_i8(i32 %a, i32 %b, i1 %tst) {
; CHECK-LABEL: test_add_i8:
; CHECK-T1: adds r0, #12
; CHECK-T2: add.w r0, {{r[0-9]+}}, #12

  %tmp = and i32 %a, -256
  %tmp1 = and i32 %b, -512
  %int = select i1 %tst, i32 %tmp, i32 %tmp1
  %res = or i32 %int, 12
  ret i32 %res
}

define i32 @test_add_i12(i32 %a, i32 %b, i1 %tst) {
; CHECK-LABEL: test_add_i12:
; CHECK-T2: addw r0, {{r[0-9]+}}, #854

  %tmp = and i32 %a, -4096
  %tmp1 = and i32 %b, -8192
  %int = select i1 %tst, i32 %tmp, i32 %tmp1
  %res = or i32 %int, 854
  ret i32 %res
}

declare void @foo(i32)