[PATCH] D152351: [clang] Add __builtin_isfpclass

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 9 11:56:12 PDT 2023


arsenm added a comment.

Typo builting in commit message



================
Comment at: clang/docs/LanguageExtensions.rst:3418
+
+This function never raises floating-point exceptions.
+
----------------
Maybe also mention it doesn't canonicalize its input


================
Comment at: clang/test/CodeGen/isfpclass.c:54
+_Bool check_isfpclass_nan_f16(_Float16 x) {
+#pragma STDC FENV_ACCESS ON
+  return __builtin_isfpclass(x, 3 /*NaN*/);
----------------
Also tests without fenv access


================
Comment at: clang/test/CodeGen/isfpclass.c:56
+  return __builtin_isfpclass(x, 3 /*NaN*/);
+}
----------------
Test some vectors?


================
Comment at: clang/test/Sema/builtins.c:384
+  int x1 = __builtin_isfpclass(x, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 1023]}}
+  int x2 = __builtin_isfpclass(3, 3); // expected-error{{floating point classification requires argument of floating point type (passed in 'int')}}
+  int x3 = __builtin_isfpclass(x, 3, x); // expected-error{{too many arguments to function call, expected 2, have 3}}
----------------
For any other float argument, 3 would accept implicit conversion. Do we just not do that for these type inferring intrinsics?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152351/new/

https://reviews.llvm.org/D152351



More information about the cfe-commits mailing list