Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -march=hexagon < %s | FileCheck %s
      2 ;
      3 ; Bug 6840. Use absolute+index addressing.
      4 
      5 @ga = common global [1024 x i8] zeroinitializer, align 8
      6 @gb = common global [1024 x i8] zeroinitializer, align 8
      7 
      8 ; CHECK: memub(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##ga)
      9 define zeroext i8 @lf2(i32 %i) nounwind readonly {
     10 entry:
     11   %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i
     12   %0 = load i8, i8* %arrayidx, align 1
     13   ret i8 %0
     14 }
     15 
     16 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##gb)
     17 define signext i8 @lf2s(i32 %i) nounwind readonly {
     18 entry:
     19   %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %i
     20   %0 = load i8, i8* %arrayidx, align 1
     21   ret i8 %0
     22 }
     23 
     24 ; CHECK: memub(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##ga)
     25 define zeroext i8 @lf3(i32 %i) nounwind readonly {
     26 entry:
     27   %mul = shl nsw i32 %i, 2
     28   %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %mul
     29   %0 = load i8, i8* %arrayidx, align 1
     30   ret i8 %0
     31 }
     32 
     33 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##gb)
     34 define signext i8 @lf3s(i32 %i) nounwind readonly {
     35 entry:
     36   %mul = shl nsw i32 %i, 2
     37   %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %mul
     38   %0 = load i8, i8* %arrayidx, align 1
     39   ret i8 %0
     40 }
     41 
     42 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##ga)
     43 define void @sf4(i32 %i, i8 zeroext %j) nounwind {
     44 entry:
     45   %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i
     46   store i8 %j, i8* %arrayidx, align 1
     47   ret void
     48 }
     49 
     50 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##gb)
     51 define void @sf4s(i32 %i, i8 signext %j) nounwind {
     52 entry:
     53   %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %i
     54   store i8 %j, i8* %arrayidx, align 1
     55   ret void
     56 }
     57 
     58 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##ga)
     59 define void @sf5(i32 %i, i8 zeroext %j) nounwind {
     60 entry:
     61   %mul = shl nsw i32 %i, 2
     62   %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %mul
     63   store i8 %j, i8* %arrayidx, align 1
     64   ret void
     65 }
     66 
     67 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##gb)
     68 define void @sf5s(i32 %i, i8 signext %j) nounwind {
     69 entry:
     70   %mul = shl nsw i32 %i, 2
     71   %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %mul
     72   store i8 %j, i8* %arrayidx, align 1
     73   ret void
     74 }
     75