[ARM] Add earlyclobber constraint to pre/post-indexed ARM STRH instructions.
[oota-llvm.git] / test / CodeGen / ARM / 2014-07-18-earlyclobber-str-post.ll
1 ; RUN: llc -mtriple=armv7-linux-gnueabihf %s -o - | FileCheck %s
2
3 ; Check that we don't create an unpredictable STR instruction,
4 ; e.g. str r0, [r0], #4
5
6 define i32* @earlyclobber-str-post(i32* %addr) nounwind {
7 ; CHECK-LABEL: earlyclobber-str-post
8 ; CHECK-NOT: str r[[REG:[0-9]+]], [r[[REG]]], #4
9   %val = ptrtoint i32* %addr to i32
10   store i32 %val, i32* %addr
11   %new = getelementptr i32* %addr, i32 1
12   ret i32* %new
13 }
14
15 define i16* @earlyclobber-strh-post(i16* %addr) nounwind {
16 ; CHECK-LABEL: earlyclobber-strh-post
17 ; CHECK-NOT: strh r[[REG:[0-9]+]], [r[[REG]]], #2
18   %val = ptrtoint i16* %addr to i32
19   %tr = trunc i32 %val to i16
20   store i16 %tr, i16* %addr
21   %new = getelementptr i16* %addr, i32 1
22   ret i16* %new
23 }