File: apint-add1.ll

package info (click to toggle)
llvm-toolchain-3.7 1%3A3.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 345,556 kB
  • ctags: 362,199
  • sloc: cpp: 2,156,381; ansic: 458,339; objc: 91,547; python: 89,988; asm: 86,305; sh: 21,479; makefile: 6,853; perl: 5,601; ml: 5,458; pascal: 3,933; lisp: 2,429; xml: 686; cs: 239; php: 202; csh: 117
file content (34 lines) | stat: -rw-r--r-- 910 bytes parent folder | download | duplicates (11)
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
; This test makes sure that add instructions are properly eliminated.
; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.

; RUN: opt < %s -instcombine -S | \
; RUN:    grep -v OK | not grep add


define i1 @test1(i1 %x) {
        %tmp.2 = xor i1 %x, 1
        ;; Add of sign bit -> xor of sign bit.
        %tmp.4 = add i1 %tmp.2, 1
        ret i1 %tmp.4
}

define i47 @test2(i47 %x) {
        %tmp.2 = xor i47 %x, 70368744177664
        ;; Add of sign bit -> xor of sign bit.
        %tmp.4 = add i47 %tmp.2, 70368744177664
        ret i47 %tmp.4
}

define i15 @test3(i15 %x) {
        %tmp.2 = xor i15 %x, 16384
        ;; Add of sign bit -> xor of sign bit.
        %tmp.4 = add i15 %tmp.2, 16384
        ret i15 %tmp.4
}

define i49 @test6(i49 %x) {
        ;; (x & 254)+1 -> (x & 254)|1
        %tmp.2 = and i49 %x, 562949953421310
        %tmp.4 = add i49 %tmp.2, 1
        ret i49 %tmp.4
}