brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 033672f Raw
193 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=x86_64-linux-gnu                       -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=SSE_FAST3; RUN: llc -mtriple=x86_64-linux-gnu -regbankselect-greedy -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=SSE_GREEDY4 5define i1 @test_load_i1(ptr %p1) {6; ALL-LABEL: test_load_i1:7; ALL:       # %bb.0:8; ALL-NEXT:    movzbl (%rdi), %eax9; ALL-NEXT:    retq10  %r = load i1, ptr %p111  ret i1 %r12}13 14define i8 @test_load_i8(ptr %p1) {15; ALL-LABEL: test_load_i8:16; ALL:       # %bb.0:17; ALL-NEXT:    movzbl (%rdi), %eax18; ALL-NEXT:    retq19  %r = load i8, ptr %p120  ret i8 %r21}22 23define i16 @test_load_i16(ptr %p1) {24; ALL-LABEL: test_load_i16:25; ALL:       # %bb.0:26; ALL-NEXT:    movzwl (%rdi), %eax27; ALL-NEXT:    retq28  %r = load i16, ptr %p129  ret i16 %r30}31 32define i32 @test_load_i32(ptr %p1) {33; ALL-LABEL: test_load_i32:34; ALL:       # %bb.0:35; ALL-NEXT:    movl (%rdi), %eax36; ALL-NEXT:    retq37  %r = load i32, ptr %p138  ret i32 %r39}40 41define i64 @test_load_i64(ptr %p1) {42; ALL-LABEL: test_load_i64:43; ALL:       # %bb.0:44; ALL-NEXT:    movq (%rdi), %rax45; ALL-NEXT:    retq46  %r = load i64, ptr %p147  ret i64 %r48}49 50define float @test_load_float(ptr %p1) {51; SSE-LABEL: test_load_float:52; SSE:       # %bb.0:53; SSE-NEXT:    movl (%rdi), %eax54; SSE-NEXT:    movd %eax, %xmm055; SSE-NEXT:    retq56;57; ALL-LABEL: test_load_float:58; ALL:       # %bb.0:59; ALL-NEXT:    movl (%rdi), %eax60; ALL-NEXT:    movd %eax, %xmm061; ALL-NEXT:    retq62  %r = load float, ptr %p163  ret float %r64}65 66define double @test_load_double(ptr %p1) {67; SSE-LABEL: test_load_double:68; SSE:       # %bb.0:69; SSE-NEXT:    movq (%rdi), %rax70; SSE-NEXT:    movq %rax, %xmm071; SSE-NEXT:    retq72;73; ALL-LABEL: test_load_double:74; ALL:       # %bb.0:75; ALL-NEXT:    movq (%rdi), %rax76; ALL-NEXT:    movq %rax, %xmm077; ALL-NEXT:    retq78  %r = load double, ptr %p179  ret double %r80}81 82define ptr @test_store_i1(i1 %val, ptr %p1) {83; ALL-LABEL: test_store_i1:84; ALL:       # %bb.0:85; ALL-NEXT:    movq %rsi, %rax86; ALL-NEXT:    andb $1, %dil87; ALL-NEXT:    movb %dil, (%rsi)88; ALL-NEXT:    retq89  store i1 %val, ptr %p190  ret ptr %p1;91}92 93define ptr @test_store_i32(i32 %val, ptr %p1) {94; ALL-LABEL: test_store_i32:95; ALL:       # %bb.0:96; ALL-NEXT:    movq %rsi, %rax97; ALL-NEXT:    movl %edi, (%rsi)98; ALL-NEXT:    retq99  store i32 %val, ptr %p1100  ret ptr %p1;101}102 103define ptr @test_store_i64(i64 %val, ptr %p1) {104; ALL-LABEL: test_store_i64:105; ALL:       # %bb.0:106; ALL-NEXT:    movq %rsi, %rax107; ALL-NEXT:    movq %rdi, (%rsi)108; ALL-NEXT:    retq109  store i64 %val, ptr %p1110  ret ptr %p1;111}112 113define ptr @test_store_float(float %val, ptr %p1) {114;115; SSE_FAST-LABEL: test_store_float:116; SSE_FAST:       # %bb.0:117; SSE_FAST-NEXT:    movq %rdi, %rax118; SSE_FAST-NEXT:    movd %xmm0, %ecx119; SSE_FAST-NEXT:    movl %ecx, (%rdi)120; SSE_FAST-NEXT:    retq121;122; SSE_GREEDY-LABEL: test_store_float:123; SSE_GREEDY:       # %bb.0:124; SSE_GREEDY-NEXT:    movq %rdi, %rax125; SSE_GREEDY-NEXT:    movss %xmm0, (%rdi)126; SSE_GREEDY-NEXT:    retq127  store float %val, ptr %p1128  ret ptr %p1;129}130 131define ptr @test_store_double(double %val, ptr %p1) {132;133; SSE_FAST-LABEL: test_store_double:134; SSE_FAST:       # %bb.0:135; SSE_FAST-NEXT:    movq %rdi, %rax136; SSE_FAST-NEXT:    movq %xmm0, %rcx137; SSE_FAST-NEXT:    movq %rcx, (%rdi)138; SSE_FAST-NEXT:    retq139;140; SSE_GREEDY-LABEL: test_store_double:141; SSE_GREEDY:       # %bb.0:142; SSE_GREEDY-NEXT:    movq %rdi, %rax143; SSE_GREEDY-NEXT:    movsd %xmm0, (%rdi)144; SSE_GREEDY-NEXT:    retq145  store double %val, ptr %p1146  ret ptr %p1;147}148 149define ptr @test_load_ptr(ptr %ptr1) {150; ALL-LABEL: test_load_ptr:151; ALL:       # %bb.0:152; ALL-NEXT:    movq (%rdi), %rax153; ALL-NEXT:    retq154  %p = load ptr, ptr %ptr1155  ret ptr %p156}157 158define void @test_store_ptr(ptr %ptr1, ptr %a) {159; ALL-LABEL: test_store_ptr:160; ALL:       # %bb.0:161; ALL-NEXT:    movq %rsi, (%rdi)162; ALL-NEXT:    retq163  store ptr %a, ptr %ptr1164  ret void165}166 167define i32 @test_gep_folding(ptr %arr, i32 %val) {168; ALL-LABEL: test_gep_folding:169; ALL:       # %bb.0:170; ALL-NEXT:    movl %esi, 20(%rdi)171; ALL-NEXT:    movl 20(%rdi), %eax172; ALL-NEXT:    retq173  %arrayidx = getelementptr i32, ptr %arr, i32 5174  store i32 %val, ptr %arrayidx175  %r = load i32, ptr %arrayidx176  ret i32 %r177}178 179; check that gep index doesn't folded into memory operand180define i32 @test_gep_folding_largeGepIndex(ptr %arr, i32 %val) {181; ALL-LABEL: test_gep_folding_largeGepIndex:182; ALL:       # %bb.0:183; ALL-NEXT:    movabsq $228719476720, %rax # imm = 0x3540BE3FF0184; ALL-NEXT:    addq %rdi, %rax185; ALL-NEXT:    movl %esi, (%rax)186; ALL-NEXT:    movl (%rax), %eax187; ALL-NEXT:    retq188  %arrayidx = getelementptr i32, ptr %arr, i64 57179869180189  store i32 %val, ptr %arrayidx190  %r = load i32, ptr %arrayidx191  ret i32 %r192}193