-/* $OpenBSD: bn_arch.h,v 1.6 2023/07/09 10:36:53 jsing Exp $ */
+/* $OpenBSD: bn_arch.h,v 1.7 2023/07/09 10:37:32 jsing Exp $ */
/*
* Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
*
*out_r0 = r0;
}
+#define HAVE_BN_SUBW
+
+static inline void
+bn_subw(BN_ULONG a, BN_ULONG b, BN_ULONG *out_borrow, BN_ULONG *out_r0)
+{
+ BN_ULONG borrow, r0;
+
+ __asm__ (
+ "sub %[r0], %[a], %[b] \n"
+ "sltu %[borrow], %[a], %[r0] \n"
+ : [borrow]"=r"(borrow), [r0]"=&r"(r0)
+ : [a]"r"(a), [b]"r"(b));
+
+ *out_borrow = borrow;
+ *out_r0 = r0;
+}
+
#endif /* __GNUC__ */
#endif