Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc < %s -march=arm64 -mcpu=cyclone | FileCheck %s
      2 
      3 %struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
      4 
      5 @src = external global %struct.x
      6 @dst = external global %struct.x
      7 
      8 @.str1 = private unnamed_addr constant [31 x i8] c"DHRYSTONE PROGRAM, SOME STRING\00", align 1
      9 @.str2 = private unnamed_addr constant [36 x i8] c"DHRYSTONE PROGRAM, SOME STRING BLAH\00", align 1
     10 @.str3 = private unnamed_addr constant [24 x i8] c"DHRYSTONE PROGRAM, SOME\00", align 1
     11 @.str4 = private unnamed_addr constant [18 x i8] c"DHRYSTONE PROGR  \00", align 1
     12 @.str5 = private unnamed_addr constant [7 x i8] c"DHRYST\00", align 1
     13 @.str6 = private unnamed_addr constant [14 x i8] c"/tmp/rmXXXXXX\00", align 1
     14 @spool.splbuf = internal global [512 x i8] zeroinitializer, align 16
     15 
     16 define i32 @t0() {
     17 entry:
     18 ; CHECK-LABEL: t0:
     19 ; CHECK: ldrb [[REG0:w[0-9]+]], [x[[BASEREG:[0-9]+]], #10]
     20 ; CHECK: strb [[REG0]], [x[[BASEREG2:[0-9]+]], #10]
     21 ; CHECK: ldrh [[REG1:w[0-9]+]], [x[[BASEREG]], #8]
     22 ; CHECK: strh [[REG1]], [x[[BASEREG2]], #8]
     23 ; CHECK: ldr [[REG2:x[0-9]+]],
     24 ; CHECK: str [[REG2]],
     25   call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds (%struct.x, %struct.x* @dst, i32 0, i32 0), i8* getelementptr inbounds (%struct.x, %struct.x* @src, i32 0, i32 0), i32 11, i32 8, i1 false)
     26   ret i32 0
     27 }
     28 
     29 define void @t1(i8* nocapture %C) nounwind {
     30 entry:
     31 ; CHECK-LABEL: t1:
     32 ; CHECK: ldur [[DEST:q[0-9]+]], [x[[BASEREG:[0-9]+]], #15]
     33 ; CHECK: stur [[DEST]], [x0, #15]
     34 ; CHECK: ldr [[DEST:q[0-9]+]], [x[[BASEREG]]]
     35 ; CHECK: str [[DEST]], [x0]
     36   tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str1, i64 0, i64 0), i64 31, i32 1, i1 false)
     37   ret void
     38 }
     39 
     40 define void @t2(i8* nocapture %C) nounwind {
     41 entry:
     42 ; CHECK-LABEL: t2:
     43 ; CHECK: mov [[REG3:w[0-9]+]]
     44 ; CHECK: movk [[REG3]],
     45 ; CHECK: str [[REG3]], [x0, #32]
     46 ; CHECK: ldp [[DEST1:q[0-9]+]], [[DEST2:q[0-9]+]], [x{{[0-9]+}}]
     47 ; CHECK: stp [[DEST1]], [[DEST2]], [x0]
     48   tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str2, i64 0, i64 0), i64 36, i32 1, i1 false)
     49   ret void
     50 }
     51 
     52 define void @t3(i8* nocapture %C) nounwind {
     53 entry:
     54 ; CHECK-LABEL: t3:
     55 ; CHECK: ldr [[REG4:x[0-9]+]], [x[[BASEREG:[0-9]+]], #16]
     56 ; CHECK: str [[REG4]], [x0, #16]
     57 ; CHECK: ldr [[DEST:q[0-9]+]], [x[[BASEREG]]]
     58 ; CHECK: str [[DEST]], [x0]
     59   tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str3, i64 0, i64 0), i64 24, i32 1, i1 false)
     60   ret void
     61 }
     62 
     63 define void @t4(i8* nocapture %C) nounwind {
     64 entry:
     65 ; CHECK-LABEL: t4:
     66 ; CHECK: orr [[REG5:w[0-9]+]], wzr, #0x20
     67 ; CHECK: strh [[REG5]], [x0, #16]
     68 ; CHECK: ldr [[REG6:q[0-9]+]], [x{{[0-9]+}}]
     69 ; CHECK: str [[REG6]], [x0]
     70   tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str4, i64 0, i64 0), i64 18, i32 1, i1 false)
     71   ret void
     72 }
     73 
     74 define void @t5(i8* nocapture %C) nounwind {
     75 entry:
     76 ; CHECK-LABEL: t5:
     77 ; CHECK: strb wzr, [x0, #6]
     78 ; CHECK: mov [[REG7:w[0-9]+]], #21587
     79 ; CHECK: strh [[REG7]], [x0, #4]
     80 ; CHECK: mov [[REG8:w[0-9]+]],
     81 ; CHECK: movk [[REG8]],
     82 ; CHECK: str [[REG8]], [x0]
     83   tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str5, i64 0, i64 0), i64 7, i32 1, i1 false)
     84   ret void
     85 }
     86 
     87 define void @t6() nounwind {
     88 entry:
     89 ; CHECK-LABEL: t6:
     90 ; CHECK: ldur [[REG9:x[0-9]+]], [x{{[0-9]+}}, #6]
     91 ; CHECK: stur [[REG9]], [x{{[0-9]+}}, #6]
     92 ; CHECK: ldr
     93 ; CHECK: str
     94   call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @spool.splbuf, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str6, i64 0, i64 0), i64 14, i32 1, i1 false)
     95   ret void
     96 }
     97 
     98 %struct.Foo = type { i32, i32, i32, i32 }
     99 
    100 define void @t7(%struct.Foo* nocapture %a, %struct.Foo* nocapture %b) nounwind {
    101 entry:
    102 ; CHECK: t7
    103 ; CHECK: ldr [[REG10:q[0-9]+]], [x1]
    104 ; CHECK: str [[REG10]], [x0]
    105   %0 = bitcast %struct.Foo* %a to i8*
    106   %1 = bitcast %struct.Foo* %b to i8*
    107   tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 16, i32 4, i1 false)
    108   ret void
    109 }
    110 
    111 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
    112 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
    113