aboutsummaryrefslogtreecommitdiff
path: root/src/Specific/montgomery32_2e189m25/fesub.c
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2017-11-02 01:36:04 -0400
committerGravatar Jason Gross <jgross@mit.edu>2017-11-02 01:36:04 -0400
commit5b45aa93efa19d54e50299ff0df8ee46c60f891b (patch)
tree9cea98ab783f557b5cbca0456a4dc3b4498e43c5 /src/Specific/montgomery32_2e189m25/fesub.c
parente8bda9b779d5762c5868cd09c85142151655d5ca (diff)
Update display logs and c files
Diffstat (limited to 'src/Specific/montgomery32_2e189m25/fesub.c')
-rw-r--r--src/Specific/montgomery32_2e189m25/fesub.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Specific/montgomery32_2e189m25/fesub.c b/src/Specific/montgomery32_2e189m25/fesub.c
new file mode 100644
index 000000000..80ae99e51
--- /dev/null
+++ b/src/Specific/montgomery32_2e189m25/fesub.c
@@ -0,0 +1,46 @@
+#include <stdint.h>
+#include <stdbool.h>
+#include <x86intrin.h>
+#include "liblow.h"
+
+#include "fesub.h"
+
+typedef unsigned int uint128_t __attribute__((mode(TI)));
+
+#if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__)||defined(__INTEL_COMPILER))
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81294
+#define _subborrow_u32 __builtin_ia32_sbb_u32
+#define _subborrow_u64 __builtin_ia32_sbb_u64
+#endif
+
+#undef force_inline
+#define force_inline __attribute__((always_inline))
+
+void force_inline fesub(uint64_t* out, uint64_t x12, uint64_t x13, uint64_t x11, uint64_t x9, uint64_t x7, uint64_t x5, uint64_t x22, uint64_t x23, uint64_t x21, uint64_t x19, uint64_t x17, uint64_t x15)
+{ uint32_t x25; uint8_t x26 = _subborrow_u32(0x0, x5, x15, &x25);
+{ uint32_t x28; uint8_t x29 = _subborrow_u32(x26, x7, x17, &x28);
+{ uint32_t x31; uint8_t x32 = _subborrow_u32(x29, x9, x19, &x31);
+{ uint32_t x34; uint8_t x35 = _subborrow_u32(x32, x11, x21, &x34);
+{ uint32_t x37; uint8_t x38 = _subborrow_u32(x35, x13, x23, &x37);
+{ uint32_t x40; uint8_t x41 = _subborrow_u32(x38, x12, x22, &x40);
+{ uint32_t x42 = (uint32_t)cmovznz(x41, 0x0, 0xffffffff);
+{ uint32_t x43 = (x42 & 0xffffffe7);
+{ uint32_t x45; uint8_t x46 = _addcarryx_u32(0x0, x25, x43, &x45);
+{ uint32_t x47 = (x42 & 0xffffffff);
+{ uint32_t x49; uint8_t x50 = _addcarryx_u32(x46, x28, x47, &x49);
+{ uint32_t x51 = (x42 & 0xffffffff);
+{ uint32_t x53; uint8_t x54 = _addcarryx_u32(x50, x31, x51, &x53);
+{ uint32_t x55 = (x42 & 0xffffffff);
+{ uint32_t x57; uint8_t x58 = _addcarryx_u32(x54, x34, x55, &x57);
+{ uint32_t x59 = (x42 & 0xffffffff);
+{ uint32_t x61; uint8_t x62 = _addcarryx_u32(x58, x37, x59, &x61);
+{ uint32_t x63 = (x42 & 0x1fffffff);
+{ uint32_t x65; uint8_t _ = _addcarryx_u32(x62, x40, x63, &x65);
+out[0] = x65;
+out[1] = x61;
+out[2] = x57;
+out[3] = x53;
+out[4] = x49;
+out[5] = x45;
+}}}}}}}}}}}}}}}}}}}
+// caller: uint64_t out[6];