#if __ELF__
+// Special arrangements for position-independent code.
#if __PIC__ || __PIE__
# define WANT_PIC 1
#endif
+// Additional symbol metadata.
#define TYPE_FUNC(name) .type name, STT_FUNC
-
+#define TYPE_OBJ(name) .type name, STT_OBJECT
#define SIZE_OBJ(name) .size name, . - name
#endif
#if ABI_WIN
+// Function names need decorating on 32-bit i386.
#if CPUFAM_X86
# define F(name) _##name
#endif
.macro endprologue
.endm
+// cmov RD, RN, CC: set RD to RN if CC is satisfied, otherwise do nothing
+.macro cmov rd, rn, cc
+ csel \rd, \rn, \rd, \cc
+.endm
+
+// Notational improvement: write `csel.CC' etc., rather than `csel ..., CC'.
+#define _COND(_) \
+ _(eq) _(ne) _(cs) _(cc) _(vs) _(vc) _(mi) _(pl) \
+ _(ge) _(lt) _(gt) _(le) _(hi) _(ls) _(al) _(nv) \
+ _(hs) _(lo)
+#define _INST(_) \
+ _(ccmp) _(ccmn) \
+ _(csel) _(cmov) \
+ _(csinc) _(cinc) _(cset) \
+ _(csneg) _(cneg) \
+ _(csinv) _(cinv) _(csetm)
+#define _CONDVAR(cc) _definstvar cc;
+#define _INSTVARS(inst) \
+ .macro _definstvar cc; \
+ .macro inst.\cc args:vararg; inst \args, \cc; .endm; \
+ .endm; \
+ _COND(_CONDVAR); \
+ .purgem _definstvar;
+ _INST(_INSTVARS)
+#undef _COND
+#undef _INST
+#undef _CONDVAR
+#undef _INSTVARS
+
+// Flag bits for `ccmp' and friends.
+#define CCMP_N 8
+#define CCMP_Z 4
+#define CCMP_C 2
+#define CCMP_V 1
+
+// Flag settings for satisfying conditions.
+#define CCMP_MI CCMP_N
+#define CCMP_PL 0
+#define CCMP_EQ CCMP_Z
+#define CCMP_NE 0
+#define CCMP_CS CCMP_C
+#define CCMP_HS CCMP_C
+#define CCMP_CC 0
+#define CCMP_LO 0
+#define CCMP_VS CCMP_V
+#define CCMP_VC 0
+#define CCMP_HI CCMP_C
+#define CCMP_LS 0
+#define CCMP_LT CCMP_N
+#define CCMP_GE 0
+#define CCMP_LE CCMP_N
+#define CCMP_GT 0
+
#endif
///--------------------------------------------------------------------------
#ifndef TYPE_FUNC
# define TYPE_FUNC(name)
#endif
-
+#ifndef TYPE_OBJ
+# define TYPE_OBJ(name)
+#endif
#ifndef SIZE_OBJ
# define SIZE_OBJ(name)
#endif
-#if __ELF__ && !defined(WANT_EXECUTABLE_STACK)
+#if __ELF__ && !defined(FORCE_EXECUTABLE_STACK)
.pushsection .note.GNU-stack, "", _SECTTY(progbits)
.popsection
#endif