1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/CodeGen/X86/pr45995-2.ll
Simon Pilgrim f6f886a614 [X86] Canonicalize SGT/UGT compares with constants to use SGE/UGE to reduce the number of EFLAGs reads. (PR48760)
This demonstrates a possible fix for PR48760 - for compares with constants, canonicalize the SGT/UGT condition code to use SGE/UGE which should reduce the number of EFLAGs bits we need to read.

As discussed on PR48760, some EFLAG bits are treated independently which can require additional uops to merge together for certain CMOVcc/SETcc/etc. modes.

I've limited this to cases where the constant increment doesn't result in a larger encoding or additional i64 constant materializations.

Differential Revision: https://reviews.llvm.org/D101074
2021-06-30 18:46:50 +01:00

29 lines
1.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -O3 --x86-asm-syntax=intel -mtriple=x86_64-grtev4-linux-gnu -march=x86-64 -mcpu=skylake-avx512 -mattr=fma,avx512f < %s | FileCheck %s
define <4 x i1> @selecter(i64 %0) {
; CHECK-LABEL: selecter:
; CHECK: # %bb.0:
; CHECK-NEXT: xor eax, eax
; CHECK-NEXT: cmp rdi, 2
; CHECK-NEXT: setge al
; CHECK-NEXT: lea eax, [rax + 2*rax]
; CHECK-NEXT: kmovd k0, eax
; CHECK-NEXT: vpmovm2d xmm0, k0
; CHECK-NEXT: ret
%2 = icmp slt i64 0, %0
%3 = select i1 %2, <4 x i1> <i1 true, i1 true, i1 false, i1 false>, <4 x i1> zeroinitializer
%4 = insertvalue [4 x <4 x i1>] zeroinitializer, <4 x i1> %3, 0
%5 = icmp slt i64 1, %0
%6 = select i1 %5, <4 x i1> <i1 true, i1 true, i1 false, i1 false>, <4 x i1> zeroinitializer
%7 = insertvalue [4 x <4 x i1>] %4, <4 x i1> %6, 1
%8 = icmp slt i64 2, %0
%9 = select i1 %8, <4 x i1> <i1 true, i1 true, i1 false, i1 false>, <4 x i1> zeroinitializer
%10 = insertvalue [4 x <4 x i1>] %7, <4 x i1> %9, 2
%11 = icmp slt i64 3, %0
%12 = select i1 %11, <4 x i1> <i1 true, i1 true, i1 false, i1 false>, <4 x i1> zeroinitializer
%13 = insertvalue [4 x <4 x i1>] %10, <4 x i1> %12, 3
%14 = extractvalue [4 x <4 x i1>] %13, 1
ret <4 x i1> %14
}