summary refs log tree commit diff
path: root/lisc/test
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-07 13:46:11 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-07 13:46:11 -0500
commit9de2a588da1d4879984992dcd03b75bd0bac8035 (patch)
tree412358fd972712c6adbc2aabec87bac798ba4e76 /lisc/test
parent7d642e85ccb0291a177cb066ab0ea5fe5c76a38b (diff)
downloadroux-9de2a588da1d4879984992dcd03b75bd0bac8035.tar.gz
test new conversion instructions
Diffstat (limited to 'lisc/test')
-rw-r--r--lisc/test/fpcnv.ssa26
1 files changed, 26 insertions, 0 deletions
diff --git a/lisc/test/fpcnv.ssa b/lisc/test/fpcnv.ssa
new file mode 100644
index 0000000..462e0e1
--- /dev/null
+++ b/lisc/test/fpcnv.ssa
@@ -0,0 +1,26 @@
+# floating point casts and conversions
+
+function s $fneg(s %f) {
+@fneg
+	%b0 =w cast %f
+	%b1 =w xor 2147483648, %b0
+	%rs =s cast %b1
+	ret %rs
+}
+
+function d $ftrunc(d %f) {
+@ftrunc
+	%l0 =l ftosi %f
+	%rt =d sitof %l0
+	ret %rt
+}
+
+# >>> driver
+# extern float fneg(float);
+# extern double ftrunc(double);
+# int main() {
+# 	if (fneg(1.234f) != -1.234f) return 1;
+# 	if (ftrunc(3.1415) != 3.0) return 2;
+# 	return 0;
+# }
+# <<<