[PATCH] D152351: [clang] Add __builtin_isfpclass
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 7 04:30:00 PDT 2023
arsenm added inline comments.
================
Comment at: clang/test/CodeGen/isfpclass.c:1
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -O1 -emit-llvm %s -o - | FileCheck %s
+
----------------
Use generated checks?
================
Comment at: clang/test/CodeGen/isfpclass.c:2
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -O1 -emit-llvm %s -o - | FileCheck %s
+
+_Bool check_isfpclass_finite(float x) {
----------------
Can you also add a half test, also vectors
================
Comment at: clang/test/CodeGen/isfpclass.c:11
+#pragma STDC FENV_ACCESS ON
+ return __builtin_isfpclass(504 /*Finite*/, x);
+}
----------------
These operands are backwards, the test should be second
================
Comment at: clang/test/Sema/builtins.c:383
+int test_is_fpclass(float x) {
+ return __builtin_isfpclass(1024, x); // expected-error {{argument value 1024 is outside the valid range [0, 1023]}}
+}
----------------
Need a test for non-immediate class mask. Also a negative value
================
Comment at: clang/test/Sema/builtins.c:384
+ return __builtin_isfpclass(1024, x); // expected-error {{argument value 1024 is outside the valid range [0, 1023]}}
+}
----------------
What happens if you pass complex?
================
Comment at: llvm/lib/IR/IRBuilder.cpp:1379
+Value *IRBuilderBase::createIsFPClass(Value *FPNum, unsigned Test) {
+ auto TestV = llvm::ConstantInt::get(Type::getInt32Ty(Context), Test);
+ Module *M = BB->getParent()->getParent();
----------------
Use IRBuilder::getInt32
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152351/new/
https://reviews.llvm.org/D152351
More information about the llvm-commits
mailing list