[llvm] [AMDGPU] Handle hazard in v_scalef32_sr_fp4_* conversions (PR #118589)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 8 06:48:07 PST 2024


================
@@ -657,9 +658,14 @@ bool isTrue16Inst(unsigned Opc) {
   return Info ? Info->IsTrue16 : false;
 }
 
-bool isFP8DstSelInst(unsigned Opc) {
-  const FP8DstByteSelInfo *Info = getFP8DstByteSelHelper(Opc);
-  return Info ? Info->HasFP8DstByteSel : false;
+FPType getFPDstSelType(unsigned Opc) {
+  const FP4FP8DstByteSelInfo *Info = getFP4FP8DstByteSelHelper(Opc);
+  if (Info && Info->HasFP8DstByteSel)
+    return FPType::FP8;
+  else if (Info && Info->HasFP4DstByteSel)
+    return FPType::FP4;
+  else
+    return FPType::None;
----------------
arsenm wrote:

```suggestion
  if (!Info)
    return FPType::None;
  if (Info->HasFP8DstByteSel)
    return FPType::FP8;
  if (Info->HasFP4DstByteSel)
    return FPType::FP4;

  llvm_unreachable("not fp4 or fp8");
```
No else after return

https://github.com/llvm/llvm-project/pull/118589


More information about the llvm-commits mailing list