File: apint-not.ll

package info (click to toggle)
llvm-3.0 3.0-10
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 75,412 kB
  • sloc: cpp: 468,043; asm: 109,345; ansic: 13,782; sh: 12,935; ml: 4,716; python: 4,351; perl: 2,096; makefile: 1,905; pascal: 1,578; exp: 389; xml: 283; lisp: 187; csh: 117
file content (42 lines) | stat: -rw-r--r-- 914 bytes parent folder | download | duplicates (14)
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
; This test makes sure that the xor instructions are properly eliminated
; when arbitrary precision integers are used.

; RUN: opt < %s -instcombine -S | not grep xor

define i33 @test1(i33 %A) {
	%B = xor i33 %A, -1
	%C = xor i33 %B, -1
	ret i33 %C
}

define i1 @test2(i52 %A, i52 %B) {
	%cond = icmp ule i52 %A, %B     ; Can change into uge
	%Ret = xor i1 %cond, true
	ret i1 %Ret
}

; Test that demorgans law can be instcombined
define i47 @test3(i47 %A, i47 %B) {
	%a = xor i47 %A, -1
	%b = xor i47 %B, -1
	%c = and i47 %a, %b
	%d = xor i47 %c, -1
	ret i47 %d
}

; Test that demorgens law can work with constants
define i61 @test4(i61 %A, i61 %B) {
	%a = xor i61 %A, -1
	%c = and i61 %a, 5    ; 5 = ~c2
	%d = xor i61 %c, -1
	ret i61 %d
}

; test the mirror of demorgans law...
define i71 @test5(i71 %A, i71 %B) {
	%a = xor i71 %A, -1
	%b = xor i71 %B, -1
	%c = or i71 %a, %b
	%d = xor i71 %c, -1
	ret i71 %d
}