qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 8e040d58615e49a63fb50dda5dc695e96a54a7bc
parent 2cba9f6871fe92e06d5e6433f8e15d2712fa9d52
Author: Michael Forney <mforney@mforney.org>
Date:   Sat, 12 Feb 2022 02:27:49 -0800

test: add c[u]od checks to isel2 and add new integer compare test isel3

Diffstat:
Mtest/isel2.ssa | 16++++++++++++++++
Atest/isel3.ssa | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 103 insertions(+), 0 deletions(-)

diff --git a/test/isel2.ssa b/test/isel2.ssa @@ -77,6 +77,18 @@ export function w $ne3(d %x, d %y) { ret 0 } +export function w $o(d %x, d %y) { +@start + %r =w cod %x, %y + ret %r +} + +export function w $uo(d %x, d %y) { +@start + %r =w cuod %x, %y + ret %r +} + # >>> driver # #include <math.h> # extern int lt(double, double); @@ -89,6 +101,8 @@ export function w $ne3(d %x, d %y) { # extern int ne1(double, double); # extern int ne2(double, double); # extern int ne3(double, double); +# extern int o(double, double); +# extern int uo(double, double); # int main(void) { # /* LessThan Equal GreaterThan Unordered */ # return !lt(0, 1) + lt(0, 0) + lt(1, 0) + lt(NAN, NAN) @@ -101,6 +115,8 @@ export function w $ne3(d %x, d %y) { # + !ne1(0, 1) + ne1(0, 0) + !ne1(1, 0) + !ne1(NAN, NAN) # + !ne2(0, 1) + ne2(0, 0) + !ne2(1, 0) + !ne2(NAN, NAN) # + !ne3(0, 1) + ne3(0, 0) + !ne3(1, 0) + !ne3(NAN, NAN) +# + !o(0, 1) + !o(0, 0) + !o(1, 0) + o(NAN, NAN) +# + uo(0, 1) + uo(0, 0) + uo(1, 0) + !uo(NAN, NAN) # ; # } # <<< diff --git a/test/isel3.ssa b/test/isel3.ssa @@ -0,0 +1,87 @@ +export function w $slt(w %x, w %y) { +@start + %r =w csltw %x, %y + ret %r +} + +export function w $sle(w %x, w %y) { +@start + %r =w cslew %x, %y + ret %r +} + +export function w $sgt(w %x, w %y) { +@start + %r =w csgtw %x, %y + ret %r +} + +export function w $sge(w %x, w %y) { +@start + %r =w csgew %x, %y + ret %r +} + +export function w $ult(w %x, w %y) { +@start + %r =w cultw %x, %y + ret %r +} + +export function w $ule(w %x, w %y) { +@start + %r =w culew %x, %y + ret %r +} + +export function w $ugt(w %x, w %y) { +@start + %r =w cugtw %x, %y + ret %r +} + +export function w $uge(w %x, w %y) { +@start + %r =w cugew %x, %y + ret %r +} + +export function w $eq(w %x, w %y) { +@start + %r =w ceqw %x, %y + ret %r +} + +export function w $ne(w %x, w %y) { +@start + %r =w cnew %x, %y + ret %r +} + +# >>> driver +# #include <math.h> +# extern int slt(int, int); +# extern int sle(int, int); +# extern int sgt(int, int); +# extern int sge(int, int); +# extern int ult(unsigned, unsigned); +# extern int ule(unsigned, unsigned); +# extern int ugt(unsigned, unsigned); +# extern int uge(unsigned, unsigned); +# extern int eq(unsigned, unsigned); +# extern int ne(unsigned, unsigned); +# int main(void) { +# /* LessThan Equal GreaterThan */ +# return !slt(-1, 0) + slt(0, 0) + slt(0, -1) +# + !sle(-1, 0) + !sle(0, 0) + sle(0, -1) +# + sgt(-1, 0) + sgt(0, 0) + !sgt(0, -1) +# + sge(-1, 0) + !sge(0, 0) + !sge(0, -1) +# + !ult(0, -1) + ult(0, 0) + ult(-1, 0) +# + !ule(0, -1) + !ule(0, 0) + ule(-1, 0) +# + ugt(0, -1) + ugt(0, 0) + !ugt(-1, 0) +# + uge(0, -1) + !uge(0, 0) + !uge(-1, 0) +# + eq(0, 1) + !eq(0, 0) + eq(1, 0) +# + !ne(0, 1) + ne(0, 0) + !ne(1, 0) +# ; +# } +# <<<