Commit 23da7b35 authored by Cyril SIX's avatar Cyril SIX
Browse files

Fixing test/regression for KVX

parent 60ff1e39
......@@ -104,6 +104,9 @@ Inductive instruction : Type :=
| Palclrd (dst: ireg) (addr: ireg)
| Palclrw (dst: ireg) (addr: ireg)
| Pclzll (rd rs: ireg)
| Pclzw (rd rs: ireg)
| Pctzll (rd rs: ireg)
| Pctzw (rd rs: ireg)
| Pstsud (rd rs1 rs2: ireg)
(** Loads *)
......
......@@ -359,7 +359,7 @@ let expand_bswap32 d s = let open Asmvliw in
emit (Psrliw(GPR32, s, _8)); emit Psemi;
emit (Pandiw(GPR32, GPR32, coqint_of_camlint 0xFFl)); emit Psemi;
emit (Pslliw(GPR32, GPR32, _16)); emit Psemi;
emit (Porw(GPR16, GPR16, GPR31)); emit Psemi;
emit (Porw(GPR16, GPR16, GPR32)); emit Psemi;
emit (Psrliw(GPR32, s, _16)); emit Psemi;
emit (Pandiw(GPR32, GPR32, coqint_of_camlint 0xFFl)); emit Psemi;
emit (Pslliw(GPR32, GPR32, _8)); emit Psemi;
......@@ -399,8 +399,14 @@ let expand_builtin_inline name args res = let open Asmvliw in
(* Vararg stuff *)
| "__builtin_va_start", [BA(IR a)], _ ->
expand_builtin_va_start a
| "__builtin_kvx_clzw", [BA(IR a)], BR(IR res) ->
emit (Pclzw(res, a))
| "__builtin_clzll", [BA(IR a)], BR(IR res) ->
emit (Pclzll(res, a))
| "__builtin_kvx_ctzw", [BA(IR a)], BR(IR res) ->
emit (Pctzw(res, a))
| "__builtin_ctzll", [BA(IR a)], BR(IR res) ->
emit (Pctzll(res, a))
| "__builtin_kvx_stsud", [BA(IR a1); BA(IR a2)], BR(IR res) ->
emit (Pstsud(res, a1, a2))
| "__builtin_kvx_get", [BA_int(n)], BR(IR res) ->
......
......@@ -73,8 +73,10 @@ let builtins = {
(* "__builtin_kvx_cbs", (TInt(IInt, []), [TInt(IUInt, [])], false); *)
(* "__builtin_kvx_cbsdl", (TInt(ILongLong, []), [TInt(IULongLong, [])], false); *)
(* "__builtin_kvx_clz", (TInt(IInt, []), [TInt(IUInt, [])], false); *)
"__builtin_clzw", (TInt(IInt, []), [TInt(IUInt, [])], false);
"__builtin_kvx_clzw", (TInt(IInt, []), [TInt(IUInt, [])], false);
"__builtin_clzll", (TInt(ILongLong, []), [TInt(IULongLong, [])], false);
"__builtin_kvx_ctzw", (TInt(IInt, []), [TInt(IUInt, [])], false);
"__builtin_ctzll", (TInt(ILongLong, []), [TInt(IULongLong, [])], false);
(* "__builtin_kvx_clzdl", (TInt(ILongLong, []), [TInt(IULongLong, [])], false); *)
(* "__builtin_kvx_cmove", (TInt(IInt, []), [TInt(IInt, []); TInt(IInt, []); TInt(IInt, [])], false); *)
(* "__builtin_kvx_ctz", (TInt(IInt, []), [TInt(IUInt, [])], false); *)
......
......@@ -414,6 +414,9 @@ module Target (*: TARGET*) =
| Psemi -> fprintf oc ";;\n"
| Pclzll (rd, rs) -> fprintf oc " clzd %a = %a\n" ireg rd ireg rs
| Pclzw (rd, rs) -> fprintf oc " clzw %a = %a\n" ireg rd ireg rs
| Pctzll (rd, rs) -> fprintf oc " ctzd %a = %a\n" ireg rd ireg rs
| Pctzw (rd, rs) -> fprintf oc " ctzw %a = %a\n" ireg rd ireg rs
| Pstsud (rd, rs1, rs2) -> fprintf oc " stsud %a = %a, %a\n" ireg rd ireg rs1 ireg rs2
......
bswap(12345678) = 78563412
bswap16(1234) = 3412
bswap64(123456789abcdef0) = f0debc9a78563412
clz(ffffffff) = 0
clz(80000000) = 0
clz(7fffffff) = 1
clz(40000000) = 1
clz(3fffffff) = 2
clz(20000000) = 2
clz(1fffffff) = 3
clz(10000000) = 3
clz(0fffffff) = 4
clz(08000000) = 4
clz(07ffffff) = 5
clz(04000000) = 5
clz(03ffffff) = 6
clz(02000000) = 6
clz(01ffffff) = 7
clz(01000000) = 7
clz(00ffffff) = 8
clz(00800000) = 8
clz(007fffff) = 9
clz(00400000) = 9
clz(003fffff) = 10
clz(00200000) = 10
clz(001fffff) = 11
clz(00100000) = 11
clz(000fffff) = 12
clz(00080000) = 12
clz(0007ffff) = 13
clz(00040000) = 13
clz(0003ffff) = 14
clz(00020000) = 14
clz(0001ffff) = 15
clz(00010000) = 15
clz(0000ffff) = 16
clz(00008000) = 16
clz(00007fff) = 17
clz(00004000) = 17
clz(00003fff) = 18
clz(00002000) = 18
clz(00001fff) = 19
clz(00001000) = 19
clz(00000fff) = 20
clz(00000800) = 20
clz(000007ff) = 21
clz(00000400) = 21
clz(000003ff) = 22
clz(00000200) = 22
clz(000001ff) = 23
clz(00000100) = 23
clz(000000ff) = 24
clz(00000080) = 24
clz(0000007f) = 25
clz(00000040) = 25
clz(0000003f) = 26
clz(00000020) = 26
clz(0000001f) = 27
clz(00000010) = 27
clz(0000000f) = 28
clz(00000008) = 28
clz(00000007) = 29
clz(00000004) = 29
clz(00000003) = 30
clz(00000002) = 30
clz(00000001) = 31
clz(00000001) = 31
clzll(ffffffffffffffff) = 0
clzll(8000000000000000) = 0
clzll(7fffffffffffffff) = 1
clzll(4000000000000000) = 1
clzll(3fffffffffffffff) = 2
clzll(2000000000000000) = 2
clzll(1fffffffffffffff) = 3
clzll(1000000000000000) = 3
clzll(0fffffffffffffff) = 4
clzll(0800000000000000) = 4
clzll(07ffffffffffffff) = 5
clzll(0400000000000000) = 5
clzll(03ffffffffffffff) = 6
clzll(0200000000000000) = 6
clzll(01ffffffffffffff) = 7
clzll(0100000000000000) = 7
clzll(00ffffffffffffff) = 8
clzll(0080000000000000) = 8
clzll(007fffffffffffff) = 9
clzll(0040000000000000) = 9
clzll(003fffffffffffff) = 10
clzll(0020000000000000) = 10
clzll(001fffffffffffff) = 11
clzll(0010000000000000) = 11
clzll(000fffffffffffff) = 12
clzll(0008000000000000) = 12
clzll(0007ffffffffffff) = 13
clzll(0004000000000000) = 13
clzll(0003ffffffffffff) = 14
clzll(0002000000000000) = 14
clzll(0001ffffffffffff) = 15
clzll(0001000000000000) = 15
clzll(0000ffffffffffff) = 16
clzll(0000800000000000) = 16
clzll(00007fffffffffff) = 17
clzll(0000400000000000) = 17
clzll(00003fffffffffff) = 18
clzll(0000200000000000) = 18
clzll(00001fffffffffff) = 19
clzll(0000100000000000) = 19
clzll(00000fffffffffff) = 20
clzll(0000080000000000) = 20
clzll(000007ffffffffff) = 21
clzll(0000040000000000) = 21
clzll(000003ffffffffff) = 22
clzll(0000020000000000) = 22
clzll(000001ffffffffff) = 23
clzll(0000010000000000) = 23
clzll(000000ffffffffff) = 24
clzll(0000008000000000) = 24
clzll(0000007fffffffff) = 25
clzll(0000004000000000) = 25
clzll(0000003fffffffff) = 26
clzll(0000002000000000) = 26
clzll(0000001fffffffff) = 27
clzll(0000001000000000) = 27
clzll(0000000fffffffff) = 28
clzll(0000000800000000) = 28
clzll(00000007ffffffff) = 29
clzll(0000000400000000) = 29
clzll(00000003ffffffff) = 30
clzll(0000000200000000) = 30
clzll(00000001ffffffff) = 31
clzll(0000000100000000) = 31
clzll(00000000ffffffff) = 32
clzll(0000000080000000) = 32
clzll(000000007fffffff) = 33
clzll(0000000040000000) = 33
clzll(000000003fffffff) = 34
clzll(0000000020000000) = 34
clzll(000000001fffffff) = 35
clzll(0000000010000000) = 35
clzll(000000000fffffff) = 36
clzll(0000000008000000) = 36
clzll(0000000007ffffff) = 37
clzll(0000000004000000) = 37
clzll(0000000003ffffff) = 38
clzll(0000000002000000) = 38
clzll(0000000001ffffff) = 39
clzll(0000000001000000) = 39
clzll(0000000000ffffff) = 40
clzll(0000000000800000) = 40
clzll(00000000007fffff) = 41
clzll(0000000000400000) = 41
clzll(00000000003fffff) = 42
clzll(0000000000200000) = 42
clzll(00000000001fffff) = 43
clzll(0000000000100000) = 43
clzll(00000000000fffff) = 44
clzll(0000000000080000) = 44
clzll(000000000007ffff) = 45
clzll(0000000000040000) = 45
clzll(000000000003ffff) = 46
clzll(0000000000020000) = 46
clzll(000000000001ffff) = 47
clzll(0000000000010000) = 47
clzll(000000000000ffff) = 48
clzll(0000000000008000) = 48
clzll(0000000000007fff) = 49
clzll(0000000000004000) = 49
clzll(0000000000003fff) = 50
clzll(0000000000002000) = 50
clzll(0000000000001fff) = 51
clzll(0000000000001000) = 51
clzll(0000000000000fff) = 52
clzll(0000000000000800) = 52
clzll(00000000000007ff) = 53
clzll(0000000000000400) = 53
clzll(00000000000003ff) = 54
clzll(0000000000000200) = 54
clzll(00000000000001ff) = 55
clzll(0000000000000100) = 55
clzll(00000000000000ff) = 56
clzll(0000000000000080) = 56
clzll(000000000000007f) = 57
clzll(0000000000000040) = 57
clzll(000000000000003f) = 58
clzll(0000000000000020) = 58
clzll(000000000000001f) = 59
clzll(0000000000000010) = 59
clzll(000000000000000f) = 60
clzll(0000000000000008) = 60
clzll(0000000000000007) = 61
clzll(0000000000000004) = 61
clzll(0000000000000003) = 62
clzll(0000000000000002) = 62
clzll(0000000000000001) = 63
clzll(0000000000000001) = 63
ctz(00000001) = 0
ctz(ffffffff) = 0
ctz(00000002) = 1
ctz(fffffffe) = 1
ctz(00000004) = 2
ctz(fffffffc) = 2
ctz(00000008) = 3
ctz(fffffff8) = 3
ctz(00000010) = 4
ctz(fffffff0) = 4
ctz(00000020) = 5
ctz(ffffffe0) = 5
ctz(00000040) = 6
ctz(ffffffc0) = 6
ctz(00000080) = 7
ctz(ffffff80) = 7
ctz(00000100) = 8
ctz(ffffff00) = 8
ctz(00000200) = 9
ctz(fffffe00) = 9
ctz(00000400) = 10
ctz(fffffc00) = 10
ctz(00000800) = 11
ctz(fffff800) = 11
ctz(00001000) = 12
ctz(fffff000) = 12
ctz(00002000) = 13
ctz(ffffe000) = 13
ctz(00004000) = 14
ctz(ffffc000) = 14
ctz(00008000) = 15
ctz(ffff8000) = 15
ctz(00010000) = 16
ctz(ffff0000) = 16
ctz(00020000) = 17
ctz(fffe0000) = 17
ctz(00040000) = 18
ctz(fffc0000) = 18
ctz(00080000) = 19
ctz(fff80000) = 19
ctz(00100000) = 20
ctz(fff00000) = 20
ctz(00200000) = 21
ctz(ffe00000) = 21
ctz(00400000) = 22
ctz(ffc00000) = 22
ctz(00800000) = 23
ctz(ff800000) = 23
ctz(01000000) = 24
ctz(ff000000) = 24
ctz(02000000) = 25
ctz(fe000000) = 25
ctz(04000000) = 26
ctz(fc000000) = 26
ctz(08000000) = 27
ctz(f8000000) = 27
ctz(10000000) = 28
ctz(f0000000) = 28
ctz(20000000) = 29
ctz(e0000000) = 29
ctz(40000000) = 30
ctz(c0000000) = 30
ctz(80000000) = 31
ctz(80000000) = 31
ctzll(0000000000000001) = 0
ctzll(ffffffffffffffff) = 0
ctzll(0000000000000002) = 1
ctzll(fffffffffffffffe) = 1
ctzll(0000000000000004) = 2
ctzll(fffffffffffffffc) = 2
ctzll(0000000000000008) = 3
ctzll(fffffffffffffff8) = 3
ctzll(0000000000000010) = 4
ctzll(fffffffffffffff0) = 4
ctzll(0000000000000020) = 5
ctzll(ffffffffffffffe0) = 5
ctzll(0000000000000040) = 6
ctzll(ffffffffffffffc0) = 6
ctzll(0000000000000080) = 7
ctzll(ffffffffffffff80) = 7
ctzll(0000000000000100) = 8
ctzll(ffffffffffffff00) = 8
ctzll(0000000000000200) = 9
ctzll(fffffffffffffe00) = 9
ctzll(0000000000000400) = 10
ctzll(fffffffffffffc00) = 10
ctzll(0000000000000800) = 11
ctzll(fffffffffffff800) = 11
ctzll(0000000000001000) = 12
ctzll(fffffffffffff000) = 12
ctzll(0000000000002000) = 13
ctzll(ffffffffffffe000) = 13
ctzll(0000000000004000) = 14
ctzll(ffffffffffffc000) = 14
ctzll(0000000000008000) = 15
ctzll(ffffffffffff8000) = 15
ctzll(0000000000010000) = 16
ctzll(ffffffffffff0000) = 16
ctzll(0000000000020000) = 17
ctzll(fffffffffffe0000) = 17
ctzll(0000000000040000) = 18
ctzll(fffffffffffc0000) = 18
ctzll(0000000000080000) = 19
ctzll(fffffffffff80000) = 19
ctzll(0000000000100000) = 20
ctzll(fffffffffff00000) = 20
ctzll(0000000000200000) = 21
ctzll(ffffffffffe00000) = 21
ctzll(0000000000400000) = 22
ctzll(ffffffffffc00000) = 22
ctzll(0000000000800000) = 23
ctzll(ffffffffff800000) = 23
ctzll(0000000001000000) = 24
ctzll(ffffffffff000000) = 24
ctzll(0000000002000000) = 25
ctzll(fffffffffe000000) = 25
ctzll(0000000004000000) = 26
ctzll(fffffffffc000000) = 26
ctzll(0000000008000000) = 27
ctzll(fffffffff8000000) = 27
ctzll(0000000010000000) = 28
ctzll(fffffffff0000000) = 28
ctzll(0000000020000000) = 29
ctzll(ffffffffe0000000) = 29
ctzll(0000000040000000) = 30
ctzll(ffffffffc0000000) = 30
ctzll(0000000080000000) = 31
ctzll(ffffffff80000000) = 31
ctzll(0000000100000000) = 32
ctzll(ffffffff00000000) = 32
ctzll(0000000200000000) = 33
ctzll(fffffffe00000000) = 33
ctzll(0000000400000000) = 34
ctzll(fffffffc00000000) = 34
ctzll(0000000800000000) = 35
ctzll(fffffff800000000) = 35
ctzll(0000001000000000) = 36
ctzll(fffffff000000000) = 36
ctzll(0000002000000000) = 37
ctzll(ffffffe000000000) = 37
ctzll(0000004000000000) = 38
ctzll(ffffffc000000000) = 38
ctzll(0000008000000000) = 39
ctzll(ffffff8000000000) = 39
ctzll(0000010000000000) = 40
ctzll(ffffff0000000000) = 40
ctzll(0000020000000000) = 41
ctzll(fffffe0000000000) = 41
ctzll(0000040000000000) = 42
ctzll(fffffc0000000000) = 42
ctzll(0000080000000000) = 43
ctzll(fffff80000000000) = 43
ctzll(0000100000000000) = 44
ctzll(fffff00000000000) = 44
ctzll(0000200000000000) = 45
ctzll(ffffe00000000000) = 45
ctzll(0000400000000000) = 46
ctzll(ffffc00000000000) = 46
ctzll(0000800000000000) = 47
ctzll(ffff800000000000) = 47
ctzll(0001000000000000) = 48
ctzll(ffff000000000000) = 48
ctzll(0002000000000000) = 49
ctzll(fffe000000000000) = 49
ctzll(0004000000000000) = 50
ctzll(fffc000000000000) = 50
ctzll(0008000000000000) = 51
ctzll(fff8000000000000) = 51
ctzll(0010000000000000) = 52
ctzll(fff0000000000000) = 52
ctzll(0020000000000000) = 53
ctzll(ffe0000000000000) = 53
ctzll(0040000000000000) = 54
ctzll(ffc0000000000000) = 54
ctzll(0080000000000000) = 55
ctzll(ff80000000000000) = 55
ctzll(0100000000000000) = 56
ctzll(ff00000000000000) = 56
ctzll(0200000000000000) = 57
ctzll(fe00000000000000) = 57
ctzll(0400000000000000) = 58
ctzll(fc00000000000000) = 58
ctzll(0800000000000000) = 59
ctzll(f800000000000000) = 59
ctzll(1000000000000000) = 60
ctzll(f000000000000000) = 60
ctzll(2000000000000000) = 61
ctzll(e000000000000000) = 61
ctzll(4000000000000000) = 62
ctzll(c000000000000000) = 62
ctzll(8000000000000000) = 63
ctzll(8000000000000000) = 63
fabs(3.141590) = 3.141590
fabs(-3.141590) = 3.141590
fabsf(7.250000) = 7.250000
fabsf(-7.250000) = 7.250000
......@@ -44,8 +44,10 @@ int main(int argc, char ** argv)
printf("fabs(%f) = %f\n", -a, __builtin_fabs(-a));
printf("fabsf(%f) = %f\n", f, __builtin_fabsf(f));
printf("fabsf(%f) = %f\n", -f, __builtin_fabsf(-f));
#ifndef __KVX__ // no builtin FSQRT or SQRT on KVX
printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a));
printf("sqrt(%f) = %f\n", a, __builtin_sqrt(a));
#endif
/* Make sure that ignoring the result of a builtin
doesn't cause an internal error */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment