[PATCH] D129954: [CodeGen][inlineasm] assume the flag output of inline asm is boolean value

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 29 01:34:09 PDT 2022


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM. After some further consideration, implementing this properly in LLVM would probably take more effort than is worthwhile (especially as this is target-specific functionality, so we'd actually have to expose TTI queries for this, etc.)



================
Comment at: clang/lib/CodeGen/CGStmt.cpp:2734
+      llvm::Value *IsBooleanValue =
+          Builder.CreateCmp(llvm::CmpInst::ICMP_ULE, Tmp, OneVal);
+      llvm::Function *FnAssume = CGM.getIntrinsic(llvm::Intrinsic::assume);
----------------
The canonical form of this is `< 2` rather than `<= 1`.


================
Comment at: clang/test/CodeGen/inline-asm-x86-flag-output.c:378
+
+int test_assume_boolean_flag(long nr, volatile long *addr) {
+  //CHECK-LABEL: @test_assume_boolean_flag
----------------
You might want to check that we're doing the right thing if there are multiple output constraints (via extractvalue).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129954



More information about the cfe-commits mailing list