Home | History | Annotate | Download | only in CBackend
      1 ; RUN: llc < %s -march=c | \
      2 ; RUN:   grep __BITCAST | count 14
      3 
      4 define i32 @test1(float %F) {
      5         %X = bitcast float %F to i32            ; <i32> [#uses=1]
      6         ret i32 %X
      7 }
      8 
      9 define float @test2(i32 %I) {
     10         %X = bitcast i32 %I to float            ; <float> [#uses=1]
     11         ret float %X
     12 }
     13 
     14 define i64 @test3(double %D) {
     15         %X = bitcast double %D to i64           ; <i64> [#uses=1]
     16         ret i64 %X
     17 }
     18 
     19 define double @test4(i64 %L) {
     20         %X = bitcast i64 %L to double           ; <double> [#uses=1]
     21         ret double %X
     22 }
     23 
     24 define double @test5(double %D) {
     25         %X = bitcast double %D to double                ; <double> [#uses=1]
     26         %Y = fadd double %X, 2.000000e+00                ; <double> [#uses=1]
     27         %Z = bitcast double %Y to i64           ; <i64> [#uses=1]
     28         %res = bitcast i64 %Z to double         ; <double> [#uses=1]
     29         ret double %res
     30 }
     31 
     32 define float @test6(float %F) {
     33         %X = bitcast float %F to float          ; <float> [#uses=1]
     34         %Y = fadd float %X, 2.000000e+00         ; <float> [#uses=1]
     35         %Z = bitcast float %Y to i32            ; <i32> [#uses=1]
     36         %res = bitcast i32 %Z to float          ; <float> [#uses=1]
     37         ret float %res
     38 }
     39 
     40 define i32 @main(i32 %argc, i8** %argv) {
     41         %a = call i32 @test1( float 0x400921FB40000000 )                ; <i32> [#uses=2]
     42         %b = call float @test2( i32 %a )                ; <float> [#uses=0]
     43         %c = call i64 @test3( double 0x400921FB4D12D84A )               ; <i64> [#uses=1]
     44         %d = call double @test4( i64 %c )               ; <double> [#uses=0]
     45         %e = call double @test5( double 7.000000e+00 )          ; <double> [#uses=0]
     46         %f = call float @test6( float 7.000000e+00 )            ; <float> [#uses=0]
     47         ret i32 %a
     48 }
     49 
     50