brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.8 KiB · 4301498 Raw
172 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; RUN: llc -fixup-byte-word-insts=1 < %s | FileCheck %s -check-prefix=BWON3; RUN: llc -fixup-byte-word-insts=0 < %s | FileCheck %s -check-prefix=BWOFF4 5target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"6target triple = "x86_64-apple-macosx10.8.0"7 8%struct.A = type { i8, i8, i8, i8, i8, i8, i8, i8 }9 10; This has byte loads interspersed with byte stores, in a single11; basic-block loop.  The upper portion should be dead, so the movb loads12; should have been changed into movzbl instead.13define void @foo1(i32 %count, ptr noalias nocapture %q, ptr noalias nocapture %p) nounwind uwtable noinline ssp {14; BWON-LABEL: foo1:15; BWON:       ## %bb.0:16; BWON-NEXT:    testl %edi, %edi17; BWON-NEXT:    jle LBB0_218; BWON-NEXT:    .p2align 419; BWON-NEXT:  LBB0_1: ## %a420; BWON-NEXT:    ## =>This Inner Loop Header: Depth=121; BWON-NEXT:    movzbl (%rsi), %eax22; BWON-NEXT:    movb %al, (%rdx)23; BWON-NEXT:    movzbl 1(%rsi), %eax24; BWON-NEXT:    movb %al, 1(%rdx)25; BWON-NEXT:    addq $8, %rdx26; BWON-NEXT:    decl %edi27; BWON-NEXT:    jne LBB0_128; BWON-NEXT:  LBB0_2: ## %._crit_edge29; BWON-NEXT:    retq30;31; BWOFF-LABEL: foo1:32; BWOFF:       ## %bb.0:33; BWOFF-NEXT:    testl %edi, %edi34; BWOFF-NEXT:    jle LBB0_235; BWOFF-NEXT:    .p2align 436; BWOFF-NEXT:  LBB0_1: ## %a437; BWOFF-NEXT:    ## =>This Inner Loop Header: Depth=138; BWOFF-NEXT:    movb (%rsi), %al39; BWOFF-NEXT:    movb %al, (%rdx)40; BWOFF-NEXT:    movb 1(%rsi), %al41; BWOFF-NEXT:    movb %al, 1(%rdx)42; BWOFF-NEXT:    addq $8, %rdx43; BWOFF-NEXT:    decl %edi44; BWOFF-NEXT:    jne LBB0_145; BWOFF-NEXT:  LBB0_2: ## %._crit_edge46; BWOFF-NEXT:    retq47  %1 = icmp sgt i32 %count, 048  br i1 %1, label %.lr.ph, label %._crit_edge49 50.lr.ph:                                           ; preds = %051  %2 = getelementptr inbounds %struct.A, ptr %q, i64 0, i32 152  br label %a453 54a4:                                       ; preds = %3, %.lr.ph55  %i.02 = phi i32 [ 0, %.lr.ph ], [ %a9, %a4 ]56  %.01 = phi ptr [ %p, %.lr.ph ], [ %a10, %a4 ]57  %a5 = load i8, ptr %q, align 158  store i8 %a5, ptr %.01, align 159  %a8 = getelementptr inbounds %struct.A, ptr %.01, i64 0, i32 160  %a6 = load i8, ptr %2, align 161  store i8 %a6, ptr %a8, align 162  %a9 = add nsw i32 %i.02, 163  %a10 = getelementptr inbounds %struct.A, ptr %.01, i64 164  %exitcond = icmp eq i32 %a9, %count65  br i1 %exitcond, label %._crit_edge, label %a466 67._crit_edge:                                      ; preds = %3, %068  ret void69}70 71%struct.B = type { i16, i16, i16, i16, i16, i16, i16, i16 }72 73; This has word loads interspersed with word stores.74; The upper portion should be dead, so the movw loads should have75; been changed into movzwl instead.76define void @foo2(i32 %count, ptr noalias nocapture %q, ptr noalias nocapture %p) nounwind uwtable noinline ssp {77; BWON-LABEL: foo2:78; BWON:       ## %bb.0:79; BWON-NEXT:    testl %edi, %edi80; BWON-NEXT:    jle LBB1_281; BWON-NEXT:    .p2align 482; BWON-NEXT:  LBB1_1: ## %a483; BWON-NEXT:    ## =>This Inner Loop Header: Depth=184; BWON-NEXT:    movzwl (%rsi), %eax85; BWON-NEXT:    movw %ax, (%rdx)86; BWON-NEXT:    movzwl 2(%rsi), %eax87; BWON-NEXT:    movw %ax, 2(%rdx)88; BWON-NEXT:    addq $16, %rdx89; BWON-NEXT:    decl %edi90; BWON-NEXT:    jne LBB1_191; BWON-NEXT:  LBB1_2: ## %._crit_edge92; BWON-NEXT:    retq93;94; BWOFF-LABEL: foo2:95; BWOFF:       ## %bb.0:96; BWOFF-NEXT:    testl %edi, %edi97; BWOFF-NEXT:    jle LBB1_298; BWOFF-NEXT:    .p2align 499; BWOFF-NEXT:  LBB1_1: ## %a4100; BWOFF-NEXT:    ## =>This Inner Loop Header: Depth=1101; BWOFF-NEXT:    movw (%rsi), %ax102; BWOFF-NEXT:    movw %ax, (%rdx)103; BWOFF-NEXT:    movw 2(%rsi), %ax104; BWOFF-NEXT:    movw %ax, 2(%rdx)105; BWOFF-NEXT:    addq $16, %rdx106; BWOFF-NEXT:    decl %edi107; BWOFF-NEXT:    jne LBB1_1108; BWOFF-NEXT:  LBB1_2: ## %._crit_edge109; BWOFF-NEXT:    retq110  %1 = icmp sgt i32 %count, 0111  br i1 %1, label %.lr.ph, label %._crit_edge112 113.lr.ph:                                           ; preds = %0114  %2 = getelementptr inbounds %struct.B, ptr %q, i64 0, i32 1115  br label %a4116 117a4:                                       ; preds = %3, %.lr.ph118  %i.02 = phi i32 [ 0, %.lr.ph ], [ %a9, %a4 ]119  %.01 = phi ptr [ %p, %.lr.ph ], [ %a10, %a4 ]120  %a5 = load i16, ptr %q, align 2121  store i16 %a5, ptr %.01, align 2122  %a8 = getelementptr inbounds %struct.B, ptr %.01, i64 0, i32 1123  %a6 = load i16, ptr %2, align 2124  store i16 %a6, ptr %a8, align 2125  %a9 = add nsw i32 %i.02, 1126  %a10 = getelementptr inbounds %struct.B, ptr %.01, i64 1127  %exitcond = icmp eq i32 %a9, %count128  br i1 %exitcond, label %._crit_edge, label %a4129 130._crit_edge:                                      ; preds = %3, %0131  ret void132}133 134; This test contains nothing but a simple byte load and store.135; movb encodes smaller, but we use movzbl for the load for better perf.136define void @foo3(ptr%dst, ptr%src) {137; BWON-LABEL: foo3:138; BWON:       ## %bb.0:139; BWON-NEXT:    movzbl (%rsi), %eax140; BWON-NEXT:    movb %al, (%rdi)141; BWON-NEXT:    retq142;143; BWOFF-LABEL: foo3:144; BWOFF:       ## %bb.0:145; BWOFF-NEXT:    movb (%rsi), %al146; BWOFF-NEXT:    movb %al, (%rdi)147; BWOFF-NEXT:    retq148  %t0 = load i8, ptr%src, align 1149  store i8 %t0, ptr%dst, align 1150  ret void151}152 153; This test contains nothing but a simple word load and store.  Since154; movw and movzwl are the same size, we should always choose to use155; movzwl instead.156define void @foo4(ptr%dst, ptr%src) {157; BWON-LABEL: foo4:158; BWON:       ## %bb.0:159; BWON-NEXT:    movzwl (%rsi), %eax160; BWON-NEXT:    movw %ax, (%rdi)161; BWON-NEXT:    retq162;163; BWOFF-LABEL: foo4:164; BWOFF:       ## %bb.0:165; BWOFF-NEXT:    movw (%rsi), %ax166; BWOFF-NEXT:    movw %ax, (%rdi)167; BWOFF-NEXT:    retq168  %t0 = load i16, ptr%src, align 2169  store i16 %t0, ptr%dst, align 2170  ret void171}172