From 8032c5f68cf122a14da0df5b14e01a84d698b06d Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 27 Apr 2022 21:09:53 +0100 Subject: [PATCH] [X86] setcc.ll - add bmi2 + tbm test coverage As discussed on Issue #55138 - BMI2 (fast shrx) shouldn't always fold to BT --- llvm/test/CodeGen/X86/setcc.ll | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/llvm/test/CodeGen/X86/setcc.ll b/llvm/test/CodeGen/X86/setcc.ll index fb132ed..d600aa6 100644 --- a/llvm/test/CodeGen/X86/setcc.ll +++ b/llvm/test/CodeGen/X86/setcc.ll @@ -1,6 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=i686-apple-darwin | FileCheck %s --check-prefixes=X86 -; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefixes=X64 +; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefixes=X64,X64-BASE +; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+tbm | FileCheck %s --check-prefixes=X64,X64-TBM +; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+bmi2 | FileCheck %s --check-prefixes=X64,X64-BMI2 ; rdar://7329206 define zeroext i16 @t1(i16 zeroext %x) nounwind readnone ssp { @@ -279,13 +281,27 @@ define i16 @shift_and(i16 %a) { ; X86-NEXT: ## kill: def $ax killed $ax killed $eax ; X86-NEXT: retl ; -; X64-LABEL: shift_and: -; X64: ## %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: shrl $10, %eax -; X64-NEXT: andl $1, %eax -; X64-NEXT: ## kill: def $ax killed $ax killed $eax -; X64-NEXT: retq +; X64-BASE-LABEL: shift_and: +; X64-BASE: ## %bb.0: +; X64-BASE-NEXT: movl %edi, %eax +; X64-BASE-NEXT: shrl $10, %eax +; X64-BASE-NEXT: andl $1, %eax +; X64-BASE-NEXT: ## kill: def $ax killed $ax killed $eax +; X64-BASE-NEXT: retq +; +; X64-TBM-LABEL: shift_and: +; X64-TBM: ## %bb.0: +; X64-TBM-NEXT: bextrl $266, %edi, %eax ## imm = 0x10A +; X64-TBM-NEXT: ## kill: def $ax killed $ax killed $eax +; X64-TBM-NEXT: retq +; +; X64-BMI2-LABEL: shift_and: +; X64-BMI2: ## %bb.0: +; X64-BMI2-NEXT: movl %edi, %eax +; X64-BMI2-NEXT: shrl $10, %eax +; X64-BMI2-NEXT: andl $1, %eax +; X64-BMI2-NEXT: ## kill: def $ax killed $ax killed $eax +; X64-BMI2-NEXT: retq %and = and i16 %a, 1024 %cmp = icmp ne i16 %and, 0 %conv = zext i1 %cmp to i16 -- 2.7.4