diff options
author | Dan Gohman <sunfish@google.com> | 2014-02-12 17:50:47 -0800 |
---|---|---|
committer | Dan Gohman <sunfish@google.com> | 2014-02-12 18:16:37 -0800 |
commit | 59147c7295d0698b440f455e9080acc67aa80bff (patch) | |
tree | d96a3c8419f14bc3bdc4b97f625238c9142e9f29 /test/CodeGen/JS/basics.ll | |
parent | 08cdac187ad3a109d5e68c771ca2b2d2e23d9e3f (diff) |
Create a test directory for basic JS Codegen
Diffstat (limited to 'test/CodeGen/JS/basics.ll')
-rw-r--r-- | test/CodeGen/JS/basics.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGen/JS/basics.ll b/test/CodeGen/JS/basics.ll new file mode 100644 index 0000000000..8c84b6b37b --- /dev/null +++ b/test/CodeGen/JS/basics.ll @@ -0,0 +1,27 @@ +; RUN: llc < %s -march=js -o - | FileCheck %s + +; CHECK: function _simple_integer_math( +; CHECK: [[VAL_A:\$[a-z]+]] = [[VAL_A]]|0; +; CHECK: [[VAL_B:\$[a-z]+]] = [[VAL_B]]|0; +; CHECK: [[VAL_C:\$[a-z]+]] = (([[VAL_A]]) + ([[VAL_B]]))|0; +; CHECK: [[VAL_D:\$[a-z]+]] = ([[VAL_C]]*20)|0; +; CHECK: [[VAL_E:\$[a-z]+]] = (([[VAL_D]]|0) / ([[VAL_A]]|0))&-1; +; CHECK: [[VAL_F:\$[a-z]+]] = (([[VAL_E]]) - 3)|0; +; CHECK: return [[VAL_F]]|0; +define i32 @simple_integer_math(i32 %a, i32 %b) nounwind { + %c = add i32 %a, %b + %d = mul i32 %c, 20 + %e = sdiv i32 %d, %a + %f = sub i32 %e, 3 + ret i32 %f +} + +; CHECK: function _fneg( +; CHECK: [[VAL_D:\$[a-z]+]] = +[[VAL_D]] +; CHECK: [[VAL_F:\$[a-z]+]] = +0 +; CHECK: [[VAL_F]] = -[[VAL_D]] +; CHECK: return +[[VAL_F]]; +define double @fneg(double %d) nounwind { + %f = fsub double -0.0, %d + ret double %f +} |