mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-22 03:35:35 -04:00
c7efeba668
Summary: X86ISelDAGToDAG tries to analyze ANDs compared with 0 to optimize to narrower immediates using subregisters. I don't think we should be optimizing to 16-bit test instructions. It goes against our normal behavior of promoting i16 operations to i32. It only saves one byte due to the need to add a 0x66 prefix. I think it would also be subject to a length changing prefix penalty in the decoders on Intel CPUs. Reviewers: RKSimon, zvi, spatel Reviewed By: spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38273 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314474 91177308-0d34-0410-b5e6-96231b3b80d8
194 lines
3.8 KiB
LLVM
194 lines
3.8 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=CHECK-64
|
|
; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefix=CHECK-64
|
|
; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefix=CHECK-32
|
|
|
|
; CHECK-64-LABEL: g64xh:
|
|
; CHECK-64: btl $11
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g64xh:
|
|
; CHECK-32: btl $11
|
|
; CHECK-32: ret
|
|
define void @g64xh(i64 inreg %x) nounwind {
|
|
%t = and i64 %x, 2048
|
|
%s = icmp eq i64 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g64xl:
|
|
; CHECK-64: testb $8, [[A0L:%dil|%cl]]
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g64xl:
|
|
; CHECK-32: testb $8, %al
|
|
; CHECK-32: ret
|
|
define void @g64xl(i64 inreg %x) nounwind {
|
|
%t = and i64 %x, 8
|
|
%s = icmp eq i64 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g32xh:
|
|
; CHECK-64: btl $11
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g32xh:
|
|
; CHECK-32: btl $11
|
|
; CHECK-32: ret
|
|
define void @g32xh(i32 inreg %x) nounwind {
|
|
%t = and i32 %x, 2048
|
|
%s = icmp eq i32 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g32xl:
|
|
; CHECK-64: testb $8, [[A0L]]
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g32xl:
|
|
; CHECK-32: testb $8, %al
|
|
; CHECK-32: ret
|
|
define void @g32xl(i32 inreg %x) nounwind {
|
|
%t = and i32 %x, 8
|
|
%s = icmp eq i32 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g16xh:
|
|
; CHECK-64: btl $11
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g16xh:
|
|
; CHECK-32: btl $11
|
|
; CHECK-32: ret
|
|
define void @g16xh(i16 inreg %x) nounwind {
|
|
%t = and i16 %x, 2048
|
|
%s = icmp eq i16 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g16xl:
|
|
; CHECK-64: testb $8, [[A0L]]
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g16xl:
|
|
; CHECK-32: testb $8, %al
|
|
; CHECK-32: ret
|
|
define void @g16xl(i16 inreg %x) nounwind {
|
|
%t = and i16 %x, 8
|
|
%s = icmp eq i16 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g64x16:
|
|
; CHECK-64: testl $32896, %[[A0D:edi|ecx]]
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g64x16:
|
|
; CHECK-32: testl $32896, %eax
|
|
; CHECK-32: ret
|
|
define void @g64x16(i64 inreg %x) nounwind {
|
|
%t = and i64 %x, 32896
|
|
%s = icmp eq i64 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g64x16minsize:
|
|
; CHECK-64: testw $-32640, %[[A0W:di|cx]]
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g64x16minsize:
|
|
; CHECK-32: testw $-32640, %ax
|
|
; CHECK-32: ret
|
|
define void @g64x16minsize(i64 inreg %x) nounwind minsize {
|
|
%t = and i64 %x, 32896
|
|
%s = icmp eq i64 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g32x16:
|
|
; CHECK-64: testl $32896, %[[A0D]]
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g32x16:
|
|
; CHECK-32: testl $32896, %eax
|
|
; CHECK-32: ret
|
|
define void @g32x16(i32 inreg %x) nounwind {
|
|
%t = and i32 %x, 32896
|
|
%s = icmp eq i32 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g32x16minsize:
|
|
; CHECK-64: testw $-32640, %[[A0W]]
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g32x16minsize:
|
|
; CHECK-32: testw $-32640, %ax
|
|
; CHECK-32: ret
|
|
define void @g32x16minsize(i32 inreg %x) nounwind minsize {
|
|
%t = and i32 %x, 32896
|
|
%s = icmp eq i32 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
; CHECK-64-LABEL: g64x32:
|
|
; CHECK-64: testl $268468352, %[[A0D]]
|
|
; CHECK-64: ret
|
|
; CHECK-32-LABEL: g64x32:
|
|
; CHECK-32: testl $268468352, %eax
|
|
; CHECK-32: ret
|
|
define void @g64x32(i64 inreg %x) nounwind {
|
|
%t = and i64 %x, 268468352
|
|
%s = icmp eq i64 %t, 0
|
|
br i1 %s, label %yes, label %no
|
|
|
|
yes:
|
|
call void @bar()
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
|
|
declare void @bar()
|