mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	another mechanical change accomplished though the power of terrible Perl scripts. I have manually switched some "s to 's to make escaping simpler. While I started this to fix tests that aren't run in all configurations, the massive number of tests is due to a really frustrating fragility of our testing infrastructure: things like 'grep -v', 'not grep', and 'expected failures' can mask broken tests all too easily. Essentially, I'm deeply disturbed that I can change the testsuite so radically without causing any change in results for most platforms. =/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159547 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			LLVM
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			LLVM
		
	
	
	
	
	
| ; This test makes sure that and instructions are properly eliminated.
 | |
| ; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
 | |
| 
 | |
| ; RUN: opt < %s -instcombine -S | not grep "and "
 | |
| ; END.
 | |
| 
 | |
| define i39 @test0(i39 %A) {
 | |
|         %B = and i39 %A, 0 ; zero result
 | |
|         ret i39 %B
 | |
| }
 | |
| 
 | |
| define i47 @test1(i47 %A, i47 %B) {
 | |
|         ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
 | |
|         %NotA = xor i47 %A, -1
 | |
|         %NotB = xor i47 %B, -1
 | |
|         %C1 = and i47 %NotA, %NotB
 | |
|         ret i47 %C1
 | |
| }
 | |
| 
 | |
| define i15 @test2(i15 %x) {
 | |
|         %tmp.2 = and i15 %x, -1 ; noop
 | |
|         ret i15 %tmp.2
 | |
| }
 | |
| 
 | |
| define i23 @test3(i23 %x) {
 | |
|         %tmp.0 = and i23 %x, 127
 | |
|         %tmp.2 = and i23 %tmp.0, 128
 | |
|         ret i23 %tmp.2
 | |
| }
 | |
| 
 | |
| define i1 @test4(i37 %x) {
 | |
|         %A = and i37 %x, -2147483648
 | |
|         %B = icmp ne i37 %A, 0
 | |
|         ret i1 %B
 | |
| }
 | |
| 
 | |
| define i7 @test5(i7 %A, i7* %P) {
 | |
|         %B = or i7 %A, 3
 | |
|         %C = xor i7 %B, 12
 | |
|         store i7 %C, i7* %P
 | |
|         %r = and i7 %C, 3
 | |
|         ret i7 %r
 | |
| }
 | |
| 
 | |
| define i7 @test6(i7 %A, i7 %B) {
 | |
|         ;; ~(~X & Y) --> (X | ~Y)
 | |
|         %t0 = xor i7 %A, -1
 | |
|         %t1 = and i7 %t0, %B
 | |
|         %r = xor i7 %t1, -1
 | |
|         ret i7 %r
 | |
| }
 | |
| 
 | |
| define i47 @test7(i47 %A) {
 | |
|         %X = ashr i47 %A, 39 ;; sign extend
 | |
|         %C1 = and i47 %X, 255
 | |
|         ret i47 %C1
 | |
| }
 |