• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; The hwdiv subtarget feature should only influence thumb, not arm.
2; RUN: llc < %s -mtriple=arm-gnueabi -mattr=+hwdiv | FileCheck %s -check-prefixes=ALL,AEABI-NOHWDIV
3; RUN: llc < %s -mtriple=arm-gnueabi -mattr=-hwdiv | FileCheck %s -check-prefixes=ALL,AEABI-NOHWDIV
4; RUN: llc < %s -mtriple=thumbv7-gnueabi -mattr=+hwdiv | FileCheck %s -check-prefixes=ALL,THUMB-HWDIV
5; RUN: llc < %s -mtriple=thumbv7-gnueabi -mattr=-hwdiv | FileCheck %s -check-prefixes=ALL,AEABI-NOHWDIV
6
7; The hwdiv-arm subtarget feature should only influence arm, not thumb.
8; RUN: llc < %s -mtriple=arm-gnueabi -mattr=+hwdiv-arm | FileCheck %s -check-prefixes=ALL,ARM-HWDIV
9; RUN: llc < %s -mtriple=arm-gnueabi -mattr=-hwdiv-arm | FileCheck %s -check-prefixes=ALL,AEABI-NOHWDIV
10; RUN: llc < %s -mtriple=thumbv7-gnueabi -mattr=+hwdiv-arm | FileCheck %s -check-prefixes=ALL,AEABI-NOHWDIV
11; RUN: llc < %s -mtriple=thumbv7-gnueabi -mattr=-hwdiv-arm | FileCheck %s -check-prefixes=ALL,AEABI-NOHWDIV
12
13define arm_aapcscc i32 @test_i32_srem(i32 %x, i32 %y) {
14; ALL-LABEL: test_i32_srem:
15; ARM-HWDIV: sdiv [[Q:r[0-9]+]], r0, r1
16; ARM-HWDIV: mul [[P:r[0-9]+]], [[Q]], r1
17; ARM-HWDIV: sub r0, r0, [[P]]
18; THUMB-HWDIV: sdiv [[Q:r[0-9]+]], r0, r1
19; THUMB-HWDIV: mls r0, [[Q]], r1, r0
20; AEABI-NOHWDIV: bl __aeabi_idivmod
21; AEABI-NOHWDIV: mov r0, r1
22  %r = srem i32 %x, %y
23  ret i32 %r
24}
25
26define arm_aapcscc i32 @test_i32_urem(i32 %x, i32 %y) {
27; ALL-LABEL: test_i32_urem:
28; ARM-HWDIV: udiv [[Q:r[0-9]+]], r0, r1
29; ARM-HWDIV: mul [[P:r[0-9]+]], [[Q]], r1
30; ARM-HWDIV: sub r0, r0, [[P]]
31; THUMB-HWDIV: udiv [[Q:r[0-9]+]], r0, r1
32; THUMB-HWDIV: mls r0, [[Q]], r1, r0
33; AEABI-NOHWDIV: bl __aeabi_uidivmod
34; AEABI-NOHWDIV: mov r0, r1
35  %r = urem i32 %x, %y
36  ret i32 %r
37}
38