2018-01-20 01:05:16 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
|
2010-01-12 01:03:47 +08:00
|
|
|
; rdar://7527734
|
|
|
|
|
2018-01-20 01:05:16 +08:00
|
|
|
define i32 @test1(i32 %x) nounwind ssp {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test1:
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK-NEXT: shll $5, %edi
|
|
|
|
; CHECK-NEXT: leal 3(%rdi), %eax
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%t0 = shl i32 %x, 5
|
|
|
|
%t1 = or i32 %t0, 3
|
|
|
|
ret i32 %t1
|
2010-01-12 01:03:47 +08:00
|
|
|
}
|
2010-01-12 06:03:29 +08:00
|
|
|
|
2018-01-21 02:50:09 +08:00
|
|
|
; This test no longer requires or to be converted to 3 addr form because we are
|
|
|
|
; are able to use a zero extend instead of an 'and' which gives the register
|
|
|
|
; allocator freedom.
|
2010-01-12 06:03:29 +08:00
|
|
|
define i64 @test2(i8 %A, i8 %B) nounwind {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test2:
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK: # %bb.0:
|
2018-03-02 06:32:25 +08:00
|
|
|
; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK-NEXT: shll $4, %edi
|
|
|
|
; CHECK-NEXT: andl $48, %edi
|
2018-01-21 02:50:09 +08:00
|
|
|
; CHECK-NEXT: movzbl %sil, %eax
|
|
|
|
; CHECK-NEXT: shrq $4, %rax
|
|
|
|
; CHECK-NEXT: orq %rdi, %rax
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%C = zext i8 %A to i64
|
|
|
|
%D = shl i64 %C, 4
|
|
|
|
%E = and i64 %D, 48
|
|
|
|
%F = zext i8 %B to i64
|
|
|
|
%G = lshr i64 %F, 4
|
|
|
|
%H = or i64 %G, %E
|
2010-01-12 06:03:29 +08:00
|
|
|
ret i64 %H
|
|
|
|
}
|
2010-10-08 11:57:25 +08:00
|
|
|
|
|
|
|
;; Test that OR is only emitted as LEA, not as ADD.
|
|
|
|
|
|
|
|
; No reason to emit an add here, should be an or.
|
2018-01-20 01:05:16 +08:00
|
|
|
define void @test3(i32 %x, i32* %P) nounwind readnone ssp {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test3:
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK: # %bb.0:
|
|
|
|
; CHECK-NEXT: shll $5, %edi
|
|
|
|
; CHECK-NEXT: orl $3, %edi
|
|
|
|
; CHECK-NEXT: movl %edi, (%rsi)
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%t0 = shl i32 %x, 5
|
|
|
|
%t1 = or i32 %t0, 3
|
|
|
|
store i32 %t1, i32* %P
|
2010-10-08 11:57:25 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test4(i32 %a, i32 %b) nounwind readnone ssp {
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK-LABEL: test4:
|
|
|
|
; CHECK: # %bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
|
|
|
|
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK-NEXT: andl $6, %edi
|
|
|
|
; CHECK-NEXT: andl $16, %esi
|
|
|
|
; CHECK-NEXT: leal (%rsi,%rdi), %eax
|
|
|
|
; CHECK-NEXT: retq
|
2010-10-08 11:57:25 +08:00
|
|
|
%and = and i32 %a, 6
|
|
|
|
%and2 = and i32 %b, 16
|
|
|
|
%or = or i32 %and2, %and
|
|
|
|
ret i32 %or
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @test5(i32 %a, i32 %b, i32* nocapture %P) nounwind ssp {
|
2018-01-20 01:05:16 +08:00
|
|
|
; CHECK-LABEL: test5:
|
|
|
|
; CHECK: # %bb.0:
|
|
|
|
; CHECK-NEXT: andl $6, %edi
|
|
|
|
; CHECK-NEXT: andl $16, %esi
|
|
|
|
; CHECK-NEXT: orl %edi, %esi
|
|
|
|
; CHECK-NEXT: movl %esi, (%rdx)
|
|
|
|
; CHECK-NEXT: retq
|
2010-10-08 11:57:25 +08:00
|
|
|
%and = and i32 %a, 6
|
|
|
|
%and2 = and i32 %b, 16
|
|
|
|
%or = or i32 %and2, %and
|
|
|
|
store i32 %or, i32* %P, align 4
|
|
|
|
ret void
|
|
|
|
}
|
2018-01-20 01:05:16 +08:00
|
|
|
|