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, 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, i16* %addr, i32 1 22 ret i16* %new 23 } 24 25 define i8* @earlyclobber-strb-post(i8* %addr) nounwind { 26 ; CHECK-LABEL: earlyclobber-strb-post 27 ; CHECK-NOT: strb r[[REG:[0-9]+]], [r[[REG]]], #1 28 %val = ptrtoint i8* %addr to i32 29 %tr = trunc i32 %val to i8 30 store i8 %tr, i8* %addr 31 %new = getelementptr i8, i8* %addr, i32 1 32 ret i8* %new 33 } 34