aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--measurements/2018-11-10-android/first.txt13
-rw-r--r--src/Specific/Framework/bench/fibe.c12
2 files changed, 24 insertions, 1 deletions
diff --git a/measurements/2018-11-10-android/first.txt b/measurements/2018-11-10-android/first.txt
new file mode 100644
index 000000000..5c737828f
--- /dev/null
+++ b/measurements/2018-11-10-android/first.txt
@@ -0,0 +1,13 @@
+andreser@andreser:~/fiat-crypto$ arm-linux-androideabi-gcc -pie -I ~/android-toolchain/gmp-6.1.2/ -std=gnu11 -O3 -flto -fomit-frame-pointer -fwrapv -Wno-attributes -fno-strict-aliasing -Da24_hex='0x3039' -Da24_val='12345' -Da_minus_two_over_four_array='{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x39}' -Dbitwidth='32' -Dlimb_weight_gaps_array='{26,25,26,25,26,25,26,25,26,25}' -Dmodulus_array='{0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xed}' -Dmodulus_bytes_val='32' -Dmodulus_limbs='10' -Dq_mpz='(1_mpz<<255) - 19' src/Specific/Framework/bench/gmpsec.c android-toolchain/gmp-6.1.2/.libs/libgmp.a -o /tmp/main && adb push /tmp/main /data/local/tmp/main && adb shell "time /data/local/tmp/main"
+arm-linux-androideabi-gcc: error: android-toolchain/gmp-6.1.2/.libs/libgmp.a: No such file or directory
+andreser@andreser:~/fiat-crypto$ arm-linux-androideabi-gcc -pie -I ~/android-toolchain/gmp-6.1.2/ -std=gnu11 -O3 -flto -fomit-frame-pointer -fwrapv -Wno-attributes -fno-strict-aliasing -Da24_hex='0x3039' -Da24_val='12345' -Da_minus_two_over_four_array='{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x39}' -Dbitwidth='32' -Dlimb_weight_gaps_array='{26,25,26,25,26,25,26,25,26,25}' -Dmodulus_array='{0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xed}' -Dmodulus_bytes_val='32' -Dmodulus_limbs='10' -Dq_mpz='(1_mpz<<255) - 19' src/Specific/Framework/bench/gmpsec.c ~/android-toolchain/gmp-6.1.2/.libs/libgmp.a -o /tmp/main && adb push /tmp/main /data/local/tmp/main && adb shell "time /data/local/tmp/main"
+[100%] /data/local/tmp/main
+WARNING: linker: /data/local/tmp/main: unused DT entry: type 0x6ffffffe arg 0x42c
+WARNING: linker: /data/local/tmp/main: unused DT entry: type 0x6fffffff arg 0x1
+WARNING: linker: /data/local/tmp/main has text relocations. This is wasting memory and prevents security hardening. Please fix.
+ 0m5.25s real 0m5.22s user 0m0.01s system
+andreser@andreser:~/fiat-crypto$ arm-linux-androideabi-gcc -pie -std=gnu11 -O3 -flto -fomit-frame-pointer -fwrapv -Wno-attributes -fno-strict-aliasing -Dbitwidth=32 src/Specific/Framework/bench/fibe.c -I src/Specific/solinas32_2e255m19/ -o /tmp/main && adb push /tmp/main /data/local/tmp/main && adb shell "time /data/local/tmp/main"
+[100%] /data/local/tmp/main
+WARNING: linker: /data/local/tmp/main: unused DT entry: type 0x6ffffffe arg 0x228
+WARNING: linker: /data/local/tmp/main: unused DT entry: type 0x6fffffff arg 0x1
+ 0m0.97s real 0m0.93s user 0m0.01s system
diff --git a/src/Specific/Framework/bench/fibe.c b/src/Specific/Framework/bench/fibe.c
index a1b95772a..323a6071b 100644
--- a/src/Specific/Framework/bench/fibe.c
+++ b/src/Specific/Framework/bench/fibe.c
@@ -2,7 +2,6 @@
#include <stdint.h>
#include <stdio.h>
#include <inttypes.h>
-typedef unsigned int uint128_t __attribute__((mode(TI)));
#define limb_t_(bitwidth) limb_t__(bitwidth)
#define PRIxlimb_(bitwidth) PRIxlimb__(bitwidth)
@@ -40,6 +39,11 @@ typedef unsigned int uint128_t __attribute__((mode(TI)));
static const limb_t a24[modulus_limbs] = {a24_val};
static const limb_t limb_weight_gaps[modulus_limbs] = limb_weight_gaps_array;
+#if bitwidth >= 64
+typedef unsigned int uint128_t __attribute__((mode(TI)));
+#endif
+
+// intrinsics?
#if 0
#include <immintrin.h>
@@ -72,6 +76,8 @@ static uint32_t _subborrow_u32(uint8_t c, uint32_t a, uint32_t b, uint32_t *low)
return (uint8_t) (x>>63);
}
+#if bitwidth >= 64
+
static uint64_t _mulx_u64(uint64_t a, uint64_t b, uint64_t *high) {
uint128_t x = (uint128_t)a * b;
*high = (uint64_t) (x >> 64);
@@ -93,6 +99,8 @@ static uint64_t _subborrow_u64(uint8_t c, uint64_t a, uint64_t b, uint64_t *low)
#endif
+#endif
+
static uint32_t _mulx_u32_out_u8(uint32_t a, uint32_t b, uint8_t *high) {
uint32_t tmp_high;
uint32_t ret = _mulx_u32(a, b, &tmp_high);
@@ -100,12 +108,14 @@ static uint32_t _mulx_u32_out_u8(uint32_t a, uint32_t b, uint8_t *high) {
return ret;
}
+# if bitwidth >= 64
static uint64_t _mulx_u64_out_u8(uint64_t a, uint64_t b, uint8_t *high) {
uint64_t tmp_high;
uint64_t ret = _mulx_u64(a, b, &tmp_high);
*high = (uint8_t) (tmp_high);
return ret;
}
+#endif