YunQiang Su 780054d3ff
CodeGen: Add ISD::AssertNoFPClass (#138839)
It is used to mark a value that we are sure that it is not some fcType.
The examples include:

  * An arguments of a function is marked with nofpclass
  * Output value of an intrinsic can be sure to not be some type

So that the following operation can make some assumptions.
2025-05-15 16:05:15 +08:00

26 lines
883 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=-sse2,-sse | FileCheck %s --check-prefix=NOSSE
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=SSE
@gf = global { float, float } zeroinitializer, align 8
define void @f(<2 x float> noundef nofpclass(nan inf) %e.coerce) {
; NOSSE-LABEL: f:
; NOSSE: # %bb.0: # %entry
; NOSSE-NEXT: flds {{[0-9]+}}(%rsp)
; NOSSE-NEXT: flds {{[0-9]+}}(%rsp)
; NOSSE-NEXT: movq gf@GOTPCREL(%rip), %rax
; NOSSE-NEXT: fstps 4(%rax)
; NOSSE-NEXT: fstps (%rax)
; NOSSE-NEXT: retq
;
; SSE-LABEL: f:
; SSE: # %bb.0: # %entry
; SSE-NEXT: movq gf@GOTPCREL(%rip), %rax
; SSE-NEXT: movlps %xmm0, (%rax)
; SSE-NEXT: retq
entry:
store <2 x float> %e.coerce, ptr @gf, align 8
ret void
}