Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=mipsel -mxgot -relocation-model=pic < %s | FileCheck %s -check-prefix=O32 |
Simon Dardis | 57f4ae4 | 2016-08-04 09:17:07 +0000 | [diff] [blame^] | 2 | ; RUN: llc -march=mips64el -mcpu=mips64r2 -mxgot -relocation-model=pic < %s | \ |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 3 | ; RUN: FileCheck %s -check-prefix=N64 |
| 4 | |
| 5 | @v0 = external global i32 |
| 6 | |
| 7 | define void @foo1() nounwind { |
| 8 | entry: |
Simon Dardis | 57f4ae4 | 2016-08-04 09:17:07 +0000 | [diff] [blame^] | 9 | ; O32-LABEL: foo1: |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 10 | ; O32: lui $[[R0:[0-9]+]], %got_hi(v0) |
| 11 | ; O32: addu $[[R1:[0-9]+]], $[[R0]], ${{[a-z0-9]+}} |
| 12 | ; O32: lw ${{[0-9]+}}, %got_lo(v0)($[[R1]]) |
| 13 | ; O32: lui $[[R2:[0-9]+]], %call_hi(foo0) |
| 14 | ; O32: addu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}} |
| 15 | ; O32: lw ${{[0-9]+}}, %call_lo(foo0)($[[R3]]) |
| 16 | |
Simon Dardis | 57f4ae4 | 2016-08-04 09:17:07 +0000 | [diff] [blame^] | 17 | ; N64-LABEL: foo1: |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 18 | ; N64: lui $[[R0:[0-9]+]], %got_hi(v0) |
| 19 | ; N64: daddu $[[R1:[0-9]+]], $[[R0]], ${{[a-z0-9]+}} |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 20 | ; N64: lui $[[R2:[0-9]+]], %call_hi(foo0) |
| 21 | ; N64: daddu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}} |
Simon Dardis | 57f4ae4 | 2016-08-04 09:17:07 +0000 | [diff] [blame^] | 22 | ; N64: ld ${{[0-9]+}}, %got_lo(v0)($[[R1]]) |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 23 | ; N64: ld ${{[0-9]+}}, %call_lo(foo0)($[[R3]]) |
| 24 | |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 25 | %0 = load i32, i32* @v0, align 4 |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 26 | tail call void @foo0(i32 %0) nounwind |
| 27 | ret void |
| 28 | } |
| 29 | |
| 30 | declare void @foo0(i32) |
| 31 | |
| 32 | ; call to external function. |
| 33 | |
| 34 | define void @foo2(i32* nocapture %d, i32* nocapture %s, i32 %n) nounwind { |
| 35 | entry: |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 36 | ; O32-LABEL: foo2: |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 37 | ; O32: lui $[[R2:[0-9]+]], %call_hi(memcpy) |
| 38 | ; O32: addu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}} |
| 39 | ; O32: lw ${{[0-9]+}}, %call_lo(memcpy)($[[R3]]) |
| 40 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 41 | ; N64-LABEL: foo2: |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 42 | ; N64: lui $[[R2:[0-9]+]], %call_hi(memcpy) |
| 43 | ; N64: daddu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}} |
| 44 | ; N64: ld ${{[0-9]+}}, %call_lo(memcpy)($[[R3]]) |
| 45 | |
| 46 | %0 = bitcast i32* %d to i8* |
| 47 | %1 = bitcast i32* %s to i8* |
Pete Cooper | 67cf9a7 | 2015-11-19 05:56:52 +0000 | [diff] [blame] | 48 | tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 %n, i32 4, i1 false) |
Akira Hatanaka | bb6e74a | 2012-11-21 20:40:38 +0000 | [diff] [blame] | 49 | ret void |
| 50 | } |
| 51 | |
Pete Cooper | 67cf9a7 | 2015-11-19 05:56:52 +0000 | [diff] [blame] | 52 | declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind |