-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
backend:X86clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
Certain rounding modes used for _mm_round_ps etc. can be translated to the generic equivalents:
llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Lines 1254 to 1268 in 535f604
| switch (N->getOpcode()) { | |
| default: llvm_unreachable("Unexpected opcode!"); | |
| case ISD::STRICT_FCEIL: | |
| case ISD::FCEIL: Imm = 0xA; break; | |
| case ISD::STRICT_FFLOOR: | |
| case ISD::FFLOOR: Imm = 0x9; break; | |
| case ISD::STRICT_FTRUNC: | |
| case ISD::FTRUNC: Imm = 0xB; break; | |
| case ISD::STRICT_FROUNDEVEN: | |
| case ISD::FROUNDEVEN: Imm = 0x8; break; | |
| case ISD::STRICT_FNEARBYINT: | |
| case ISD::FNEARBYINT: Imm = 0xC; break; | |
| case ISD::STRICT_FRINT: | |
| case ISD::FRINT: Imm = 0x4; break; | |
| } |
We should be trying to convert these to the ceil/floor/trunc/roundeven/nearbyint/rint intrinsics (either regular or strict/constrained depending on fp strict mode).
The scalar cases are a bit trickier requiring extraction/insertion.
I don't expect AVX512 rndscale equivalents to be fully handled in this patch, which can be messier to deal with.
Metadata
Metadata
Assignees
Labels
backend:X86clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute