[Openmp-commits] [PATCH] D132925: Add LoongArch64 Support For OpenMP

Xi Ruoyao via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 2 01:36:51 PDT 2022


xry111 added inline comments.


================
Comment at: openmp/runtime/src/z_Linux_asm.S:1802-1808
+	// Compute max(0, argc - 6) using the following bithack:
+	// max(0, x) = x - (x & (x >> 31)), where x := argc - 6
+	// Source: http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax
+	addi.d	$t0, $a3, -6
+	srai.d	$t1, $t0, 31
+	and	$t1, $t0, $t1
+	sub.d	$t0, $t0, $t1
----------------
Let's be less tricky and reduce one instruction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132925



More information about the Openmp-commits mailing list