[Hexagon] Use S2_lsr_i_r instead of S2_extractu to obtain upper halfword
llvm-svn: 257815
diff --git a/llvm/test/CodeGen/Hexagon/bit-extractu-half.ll b/llvm/test/CodeGen/Hexagon/bit-extractu-half.ll
new file mode 100644
index 0000000..fec4a02
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/bit-extractu-half.ll
@@ -0,0 +1,13 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; Pick lsr (in bit-simplification) for extracting high halfword.
+; CHECK: lsr{{.*}}#16
+
+define i32 @foo(i32 %x) #0 {
+ %a = call i32 @llvm.hexagon.S2.extractu(i32 %x, i32 16, i32 16)
+ ret i32 %a
+}
+
+declare i32 @llvm.hexagon.S2.extractu(i32, i32, i32) #0
+
+attributes #0 = { nounwind readnone }
+