Home | History | Annotate | Download | only in ConstProp
      1 ; bswap should be constant folded when it is passed a constant argument
      2 
      3 ; RUN: opt < %s -constprop -S | FileCheck %s
      4 
      5 declare i16 @llvm.bswap.i16(i16)
      6 
      7 declare i32 @llvm.bswap.i32(i32)
      8 
      9 declare i64 @llvm.bswap.i64(i64)
     10 
     11 declare i80 @llvm.bswap.i80(i80)
     12 
     13 ; CHECK-LABEL: define i16 @W(
     14 define i16 @W() {
     15         ; CHECK: ret i16 256
     16         %Z = call i16 @llvm.bswap.i16( i16 1 )          ; <i16> [#uses=1]
     17         ret i16 %Z
     18 }
     19 
     20 ; CHECK-LABEL: define i32 @X(
     21 define i32 @X() {
     22         ; CHECK: ret i32 16777216
     23         %Z = call i32 @llvm.bswap.i32( i32 1 )          ; <i32> [#uses=1]
     24         ret i32 %Z
     25 }
     26 
     27 ; CHECK-LABEL: define i64 @Y(
     28 define i64 @Y() {
     29         ; CHECK: ret i64 72057594037927936
     30         %Z = call i64 @llvm.bswap.i64( i64 1 )          ; <i64> [#uses=1]
     31         ret i64 %Z
     32 }
     33 
     34 ; CHECK-LABEL: define i80 @Z(
     35 define i80 @Z() {
     36         ; CHECK: ret i80 -450681596205739728166896
     37         ;                0xA0908070605040302010
     38         %Z = call i80 @llvm.bswap.i80( i80 76151636403560493650080 )
     39         ;                                  0x102030405060708090A0
     40         ret i80 %Z
     41 }
     42