[llvm] 293623c - [X86] Add initial computeKnownFPClass test case (#189707)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 31 09:59:08 PDT 2026
Author: Simon Pilgrim
Date: 2026-03-31T16:58:58Z
New Revision: 293623ce99d4d6819378311c1506c5ab08d1d860
URL: https://github.com/llvm/llvm-project/commit/293623ce99d4d6819378311c1506c5ab08d1d860
DIFF: https://github.com/llvm/llvm-project/commit/293623ce99d4d6819378311c1506c5ab08d1d860.diff
LOG: [X86] Add initial computeKnownFPClass test case (#189707)
Example test case for #137943 / #189583 / #189585 - failure to recognise ISD::SQRT is never neginf
Added:
llvm/test/CodeGen/X86/known-fpclass.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/known-fpclass.ll b/llvm/test/CodeGen/X86/known-fpclass.ll
new file mode 100644
index 0000000000000..020f0dd5f59d4
--- /dev/null
+++ b/llvm/test/CodeGen/X86/known-fpclass.ll
@@ -0,0 +1,31 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-- -mcpu=x86-64-v3 | FileCheck %s
+
+define i1 @sqrt_neginf_f32(float %a0) {
+; CHECK-LABEL: sqrt_neginf_f32:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vsqrtss %xmm0, %xmm0, %xmm0
+; CHECK-NEXT: vmovd %xmm0, %eax
+; CHECK-NEXT: cmpl $-8388608, %eax # imm = 0xFF800000
+; CHECK-NEXT: sete %al
+; CHECK-NEXT: retq
+ %sqr = call float @llvm.sqrt.f32(float %a0)
+ %res = tail call i1 @llvm.is.fpclass.f32(float %sqr, i32 4) ; 0x4 = "neginf"
+ ret i1 %res
+}
+
+define i1 @sqrt_neginf_v4f32(<4 x float> %a0, ptr %p1) {
+; CHECK-LABEL: sqrt_neginf_v4f32:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vsqrtps %xmm0, %xmm0
+; CHECK-NEXT: vmovaps %xmm0, (%rdi)
+; CHECK-NEXT: vextractps $0, %xmm0, %eax
+; CHECK-NEXT: cmpl $-8388608, %eax # imm = 0xFF800000
+; CHECK-NEXT: sete %al
+; CHECK-NEXT: retq
+ %sqr = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %a0)
+ store <4 x float> %sqr, ptr %p1
+ %elt = extractelement <4 x float> %sqr, i32 0
+ %res = tail call i1 @llvm.is.fpclass.f32(float %elt, i32 4) ; 0x4 = "neginf"
+ ret i1 %res
+}
More information about the llvm-commits
mailing list