summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-11 20:40:28 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-11 20:40:28 +0000
commit025ca90b7a704f2b8566b384033ea452e6679731 (patch)
tree58e975452270dbd739106af71e4bdda362fed19a
parentb943555716431cf29dee687375be519abc632a05 (diff)
downloadbcm5719-llvm-025ca90b7a704f2b8566b384033ea452e6679731.tar.gz
bcm5719-llvm-025ca90b7a704f2b8566b384033ea452e6679731.zip
Provide a test for int<->float and long<->double bitcasts.
llvm-svn: 32445
-rw-r--r--llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll48
1 files changed, 48 insertions, 0 deletions
diff --git a/llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll b/llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll
new file mode 100644
index 00000000000..9f8a7123a4d
--- /dev/null
+++ b/llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll
@@ -0,0 +1,48 @@
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=c &&
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep '__BITCAST' | wc -l | grep 14
+
+int %test1(float %F) {
+ %X = bitcast float %F to int
+ ret int %X
+}
+
+float %test2(int %I) {
+ %X = bitcast int %I to float
+ ret float %X
+}
+
+long %test3(double %D) {
+ %X = bitcast double %D to long
+ ret long %X
+}
+
+double %test4(long %L) {
+ %X = bitcast long %L to double
+ ret double %X
+}
+
+double %test5(double %D) {
+ %X = bitcast double %D to double
+ %Y = add double %X, 2.0
+ %Z = bitcast double %Y to long
+ %res = bitcast long %Z to double
+ ret double %res
+}
+
+float %test6(float %F) {
+ %X = bitcast float %F to float
+ %Y = add float %X, 2.0
+ %Z = bitcast float %Y to int
+ %res = bitcast int %Z to float
+ ret float %res
+}
+
+int %main(int %argc, sbyte** %argv) {
+ %a = call int %test1(float 3.1415926)
+ %b = call float %test2(int %a)
+ %c = call long %test3(double 3.1415926)
+ %d = call double %test4(long %c)
+ %e = call double %test5(double 7.0)
+ %f = call float %test6(float 7.0)
+ ret int %a
+}
OpenPOWER on IntegriCloud