diff options
author | Sanjay Patel <spatel@rotateright.com> | 2022-02-03 12:05:40 -0500 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2022-02-03 12:32:36 -0500 |
commit | a662456b33ed776fff3aac7d26cf238fe8048b5a (patch) | |
tree | fe3c72bd934f0a35ebdef18333640479d8bd37fc | |
parent | 3dbe33e4ec413e0cc1d16d4035b46221022f343e (diff) |
[x86] add minimal test for sbb idiom and CPU capabilities; NFC
D116804 proposes to alter codegen on this example based on
CPU tuning, so check a variety of models to confirm it works
as expected. We already have this test mixed in with several
others in another test file, but it seems wasteful to add so
many RUN lines to check this difference over and over again.
-rw-r--r-- | llvm/test/CodeGen/X86/sbb-zero-idiom.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/sbb-zero-idiom.ll b/llvm/test/CodeGen/X86/sbb-zero-idiom.ll new file mode 100644 index 000000000000..7baa937aedec --- /dev/null +++ b/llvm/test/CodeGen/X86/sbb-zero-idiom.ll @@ -0,0 +1,19 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefixes=CHECK +; RUN: llc < %s -mtriple=x86_64-- -mcpu=sandybridge | FileCheck %s --check-prefixes=CHECK +; RUN: llc < %s -mtriple=x86_64-- -mcpu=skylake | FileCheck %s --check-prefixes=CHECK +; RUN: llc < %s -mtriple=x86_64-- -mcpu=k8 | FileCheck %s --check-prefixes=CHECK +; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver1 | FileCheck %s --check-prefixes=CHECK +; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver2 | FileCheck %s --check-prefixes=CHECK +; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s --check-prefixes=CHECK + +define i32 @i32_select_0_or_neg1(i32 %x) { +; CHECK-LABEL: i32_select_0_or_neg1: +; CHECK: # %bb.0: +; CHECK-NEXT: negl %edi +; CHECK-NEXT: sbbl %eax, %eax +; CHECK-NEXT: retq + %cmp = icmp ne i32 %x, 0 + %sel = select i1 %cmp, i32 -1, i32 0 + ret i32 %sel +} |