Home | History | Annotate | Download | only in Hexagon
      1 ; Expect the constant propagation to evaluate signed and unsigned bit extract.
      2 ; RUN: llc -march=hexagon -O2 < %s | FileCheck %s
      3 
      4 target triple = "hexagon"
      5 
      6 @x = common global i32 0, align 4
      7 @y = common global i32 0, align 4
      8 
      9 define void @foo() #0 {
     10 entry:
     11   ; extractu(0x000ABCD0, 16, 4)
     12   ; should evaluate to 0xABCD (dec 43981)
     13   %0 = call i32 @llvm.hexagon.S2.extractu(i32 703696, i32 16, i32 4)
     14 ; CHECK: 43981
     15 ; CHECK-NOT: extractu
     16   store i32 %0, i32* @x, align 4
     17   ; extract(0x000ABCD0, 16, 4)
     18   ; should evaluate to 0xFFFFABCD (dec 4294945741 or -21555)
     19   %1 = call i32 @llvm.hexagon.S4.extract(i32 703696, i32 16, i32 4)
     20 ; CHECK: -21555
     21 ; CHECK-NOT: extract
     22   store i32 %1, i32* @y, align 4
     23   ret void
     24 }
     25 
     26 declare i32 @llvm.hexagon.S2.extractu(i32, i32, i32) #1
     27 
     28 declare i32 @llvm.hexagon.S4.extract(i32, i32, i32) #1
     29 
     30 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
     31 attributes #1 = { nounwind readnone }
     32