mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	input filename so that opt doesn't print the input filename in the output so that grep lines in the tests don't unintentionally match strings in the input filename. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81537 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			53 lines
		
	
	
		
			921 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			921 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
| ; RUN: opt < %s -instcombine -S | FileCheck %s
 | |
| 
 | |
| ; CHECK: define i32 @foo
 | |
| ; CHECK: sdiv i32 %x, 8
 | |
| define i32 @foo(i32 %x) {
 | |
|   %y = sdiv i32 %x, 8
 | |
|   ret i32 %y
 | |
| }
 | |
| 
 | |
| ; CHECK: define i32 @bar
 | |
| ; CHECK: ashr i32 %x, 3
 | |
| define i32 @bar(i32 %x) {
 | |
|   %y = sdiv exact i32 %x, 8
 | |
|   ret i32 %y
 | |
| }
 | |
| 
 | |
| ; CHECK: i32 @a0
 | |
| ; CHECK: %y = srem i32 %x, 3
 | |
| ; CHECK: %z = sub i32 %x, %y
 | |
| ; CHECK: ret i32 %z
 | |
| define i32 @a0(i32 %x) {
 | |
|   %y = sdiv i32 %x, 3
 | |
|   %z = mul i32 %y, 3
 | |
|   ret i32 %z
 | |
| }
 | |
| 
 | |
| ; CHECK: i32 @b0
 | |
| ; CHECK: ret i32 %x
 | |
| define i32 @b0(i32 %x) {
 | |
|   %y = sdiv exact i32 %x, 3
 | |
|   %z = mul i32 %y, 3
 | |
|   ret i32 %z
 | |
| }
 | |
| 
 | |
| ; CHECK: i32 @a1
 | |
| ; CHECK: %y = srem i32 %x, 3
 | |
| ; CHECK: %z = sub i32 %y, %x
 | |
| ; CHECK: ret i32 %z
 | |
| define i32 @a1(i32 %x) {
 | |
|   %y = sdiv i32 %x, 3
 | |
|   %z = mul i32 %y, -3
 | |
|   ret i32 %z
 | |
| }
 | |
| 
 | |
| ; CHECK: i32 @b1
 | |
| ; CHECK: %z = sub i32 0, %x
 | |
| ; CHECK: ret i32 %z
 | |
| define i32 @b1(i32 %x) {
 | |
|   %y = sdiv exact i32 %x, 3
 | |
|   %z = mul i32 %y, -3
 | |
|   ret i32 %z
 | |
| }
 |