aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/kr-function-argument-promotion.c10
-rw-r--r--test/kr-function-argument-promotion.qbe18
2 files changed, 28 insertions, 0 deletions
diff --git a/test/kr-function-argument-promotion.c b/test/kr-function-argument-promotion.c
new file mode 100644
index 0000000..7592da1
--- /dev/null
+++ b/test/kr-function-argument-promotion.c
@@ -0,0 +1,10 @@
+int f(c)
+ unsigned char c;
+{
+ return c;
+}
+
+int main(void)
+{
+ return f(0x100);
+}
diff --git a/test/kr-function-argument-promotion.qbe b/test/kr-function-argument-promotion.qbe
new file mode 100644
index 0000000..6d2f2b8
--- /dev/null
+++ b/test/kr-function-argument-promotion.qbe
@@ -0,0 +1,18 @@
+export
+function w $f(w %.1) {
+@start.1
+ %.2 =w extub %.1
+ %.3 =l alloc4 1
+ storeb %.2, %.3
+@body.2
+ %.4 =w loadub %.3
+ %.5 =w extub %.4
+ ret %.5
+}
+export
+function w $main() {
+@start.3
+@body.4
+ %.1 =w call $f(w 256)
+ ret %.1
+}