1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00
llvm-mirror/test/CodeGen/X86/icmp-opt.ll
Roman Lebedev a018732b13 [DagCombiner] Not all 'andn''s work with immediates.
Summary:
Split off from D46031.

In masked merge case, this degrades IPC by decreasing instruction count.
{F6108777}
The next patch should be able to recover and improve this.

This also affects the transform @spatel have added in D27489 / rL289738,
and the test coverage for X86 was missing.
But after i have added it, and looked at the changes in MCA, i'm somewhat confused.
{F6093591} {F6093592} {F6093593}
I'd say this regression is an improvement, since `IPC` increased in that case?

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: andreadb, llvm-commits, spatel

Differential Revision: https://reviews.llvm.org/D46493

llvm-svn: 331684
2018-05-07 21:52:11 +00:00

28 lines
919 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=-bmi < %s | FileCheck %s --check-prefix=CHECK-NOBMI
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+bmi < %s | FileCheck %s --check-prefix=CHECK-BMI
; Optimize (x > -1) to (x >= 0) etc.
; Optimize (cmp (add / sub), 0): eliminate the subs used to update flag
; for comparison only
; rdar://10233472
define i32 @t1(i64 %a) {
; CHECK-NOBMI-LABEL: t1:
; CHECK-NOBMI: # %bb.0:
; CHECK-NOBMI-NEXT: xorl %eax, %eax
; CHECK-NOBMI-NEXT: testq %rdi, %rdi
; CHECK-NOBMI-NEXT: setns %al
; CHECK-NOBMI-NEXT: retq
;
; CHECK-BMI-LABEL: t1:
; CHECK-BMI: # %bb.0:
; CHECK-BMI-NEXT: xorl %eax, %eax
; CHECK-BMI-NEXT: testq %rdi, %rdi
; CHECK-BMI-NEXT: setns %al
; CHECK-BMI-NEXT: retq
%cmp = icmp sgt i64 %a, -1
%conv = zext i1 %cmp to i32
ret i32 %conv
}