Skip to content

Commit

Permalink
[X86] Make __builtin_ia32_vec_ext_v2si require ICE for its index argu…
Browse files Browse the repository at this point in the history
…ment. Add warnings for out of range indices for __builtin_ia32_vec_ext_v2si, __builtin_ia32_vec_ext_v4hi, and __builtin_ia32_vec_set_v4hi.

These should take a constant value for an index and that constant should be a valid element number.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334051 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
topperc committed Jun 5, 2018
1 parent 571a250 commit 3faed8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/clang/Basic/BuiltinsX86.def
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TARGET_BUILTIN(__builtin_ia32_movntq, "vV1LLi*V1LLi", "n", "mmx")
TARGET_BUILTIN(__builtin_ia32_vec_init_v2si, "V2iii", "nc", "mmx")
TARGET_BUILTIN(__builtin_ia32_vec_init_v4hi, "V4sssss", "nc", "mmx")
TARGET_BUILTIN(__builtin_ia32_vec_init_v8qi, "V8ccccccccc", "nc", "mmx")
TARGET_BUILTIN(__builtin_ia32_vec_ext_v2si, "iV2ii", "nc", "mmx")
TARGET_BUILTIN(__builtin_ia32_vec_ext_v2si, "iV2iIi", "nc", "mmx")

// MMX2 (MMX+SSE) intrinsics
TARGET_BUILTIN(__builtin_ia32_cvtpi2ps, "V4fV4fV2i", "nc", "mmx,sse")
Expand Down
7 changes: 7 additions & 0 deletions lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,14 @@ bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
case X86::BI_mm_prefetch:
i = 1; l = 0; u = 7;
break;
case X86::BI__builtin_ia32_vec_ext_v2si:
i = 1; l = 0; u = 1;
break;
case X86::BI__builtin_ia32_vec_ext_v4hi:
i = 1; l = 0; u = 3;
break;
case X86::BI__builtin_ia32_sha1rnds4:
case X86::BI__builtin_ia32_vec_set_v4hi:
i = 2; l = 0; u = 3;
break;
case X86::BI__builtin_ia32_vpermil2pd:
Expand Down

0 comments on commit 3faed8d

Please sign in to comment.