[PATCH] D93625: [NFC] [TEST] Fix the threads.ll for Windows

Lubomir Litchev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 03:18:17 PST 2020


llitchev created this revision.
llitchev added a reviewer: ftynse.
llitchev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The codegen for Windows and Unix is different and 2 of the threads.ll were failing on Windows.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93625

Files:
  llvm/test/CodeGen/XCore/threads.ll


Index: llvm/test/CodeGen/XCore/threads.ll
===================================================================
--- llvm/test/CodeGen/XCore/threads.ll
+++ llvm/test/CodeGen/XCore/threads.ll
@@ -81,6 +81,10 @@
   ret i32* getelementptr inbounds ([3 x i32], [3 x i32]* @tl, i32 0, i32 2)
 }
 
+; This test fails on Windows because the second and third
+; register of the add operations are swapped.
+; Windows test is below.
+; REQUIRES: !windows
 define i32* @f_tle() {
 ; CHECK-LABEL: f_tle:
 ; CHECK: get r11, id
@@ -91,6 +95,22 @@
   ret i32* getelementptr inbounds ([2 x i32], [2 x i32]* @tle, i32 0, i32 0)
 }
 
+; Windows version of the above test.
+; REQUIRES: windows
+define i32* @f_tle_win() {
+; CHECK-LABEL: f_tle_win:
+; CHECK: get r11, id
+; CHECK: shl [[R0:r[0-9]]], r11, 3
+; CHECK: ldaw [[R1:r[0-9]]], dp[tle]
+; r0 = &tl + id*8
+; CHECK: add r0, [[R0]], [[R1]]
+  ret i32* getelementptr inbounds ([2 x i32], [2 x i32]* @tle, i32 0, i32 0)
+}
+
+; This test fails on Windows because the second and third
+; register of the first add operations are swapped.
+; Windows test is below.
+; REQUIRES: !windows
 define i32 @f_tlExpr () {
 ; CHECK-LABEL: f_tlExpr:
 ; CHECK: get r11, id
@@ -103,6 +123,20 @@
       i32 ptrtoint( i32* getelementptr inbounds ([2 x i32], [2 x i32]* @tle, i32 0, i32 0) to i32))
 }
 
+; Windows version of the above test.
+; REQUIRES: windows
+define i32 @f_tlExpr_win () {
+; CHECK-LABEL: f_tlExpr_win:
+; CHECK: get r11, id
+; CHECK: shl [[R0:r[0-9]]], r11, 3
+; CHECK: ldaw [[R1:r[0-9]]], dp[tle]
+; CHECK: add [[R2:r[0-9]]], [[R0]], [[R1]]
+; CHECK: add r0, [[R2]], [[R2]]
+  ret i32 add(
+      i32 ptrtoint( i32* getelementptr inbounds ([2 x i32], [2 x i32]* @tle, i32 0, i32 0) to i32),
+      i32 ptrtoint( i32* getelementptr inbounds ([2 x i32], [2 x i32]* @tle, i32 0, i32 0) to i32))
+}
+
 define void @phiNode1() {
 ; N.B. lowering of duplicate constexpr in a PHI node requires -O=0
 ; PHINODE-LABEL: phiNode1:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93625.313068.patch
Type: text/x-patch
Size: 1960 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201221/b28e4be5/attachment.bin>


More information about the llvm-commits mailing list