1 ; This file checks support for address mode optimization. 2 ; This test file is same as address-mode-opt.ll however the functions in this 3 ; file are relevant to MIPS only. 4 5 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ 6 ; RUN: --command %p2i --filetype=asm --assemble --disassemble \ 7 ; RUN: --target mips32 -i %s --args -O2 \ 8 ; RUN: -allow-externally-defined-symbols \ 9 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ 10 ; RUN: --command FileCheck --check-prefix MIPS32 %s 11 12 define internal float @load_arg_plus_offset(float* %arg) { 13 entry: 14 %arg.int = ptrtoint float* %arg to i32 15 %addr.int = add i32 %arg.int, 16 16 %addr.ptr = inttoptr i32 %addr.int to float* 17 %addr.load = load float, float* %addr.ptr, align 4 18 ret float %addr.load 19 } 20 ; MIPS32-LABEL: load_arg_plus_offset 21 ; MIPS32: lwc1 $f0,16(a0) 22 23 define internal float @load_arg_minus_offset(float* %arg) { 24 entry: 25 %arg.int = ptrtoint float* %arg to i32 26 %addr.int = sub i32 %arg.int, 16 27 %addr.ptr = inttoptr i32 %addr.int to float* 28 %addr.load = load float, float* %addr.ptr, align 4 29 ret float %addr.load 30 } 31 ; MIPS32-LABEL: load_arg_minus_offset 32 ; MIPS32 lwc1 $f0,-16(a0) 33 34 define internal float @address_mode_opt_chaining(float* %arg) { 35 entry: 36 %arg.int = ptrtoint float* %arg to i32 37 %addr1.int = add i32 12, %arg.int 38 %addr2.int = sub i32 %addr1.int, 4 39 %addr2.ptr = inttoptr i32 %addr2.int to float* 40 %addr2.load = load float, float* %addr2.ptr, align 4 41 ret float %addr2.load 42 } 43 ; MIPS32-LABEL: address_mode_opt_chaining 44 ; MIPS32 lwc1 $f0,8(a0) 45