================
@@ -0,0 +1,121 @@
+//===-- PISAIntrinsicUtils.cpp 
--------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/PISAIntrinsicUtils.h"
+#include "llvm/Support/AtomicOrdering.h"
+
+using namespace llvm;
+using namespace llvm::pisa;
+
+void pisa::printMemoryOrdering(raw_ostream &OS, const Constant *ImmArgVal) {
+  auto *CI = cast<ConstantInt>(ImmArgVal);
+  auto AO = static_cast<AtomicOrdering>(CI->getZExtValue());
+  if (static_cast<unsigned>(AO) > static_cast<unsigned>(AtomicOrdering::LAST))
+    return; // invalid value, print nothing
+  OS << toIRString(AO);
+}
+
+void pisa::printRoundingMode(raw_ostream &OS, const Constant *ImmArgVal) {
+  auto *CI = cast<ConstantInt>(ImmArgVal);
+  int64_t Val = CI->getSExtValue();
+  switch (static_cast<RoundingMode>(Val)) {
+  default:
----------------
mateuszchudyk wrote:

For consistency with the rest of the print functions, I would remove the 
default case.

https://github.com/llvm/llvm-project/pull/214096
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to